Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_gitgud
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Neal Luigi D. Rodriguez
midterm_gitgud
Commits
54fc5450
Commit
54fc5450
authored
May 13, 2023
by
Gareth Xerxes Yap Castillo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update views, urls, models, and settings
parent
15477754
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
14 deletions
+49
-14
models.py
widget_gitgud/Dashboard/models.py
+5
-1
dashboard.html
widget_gitgud/Dashboard/templates/Dashboard/dashboard.html
+2
-0
widgetuser-add.html
..._gitgud/Dashboard/templates/Dashboard/widgetuser-add.html
+2
-0
widgetuser-details.html
...gud/Dashboard/templates/Dashboard/widgetuser-details.html
+2
-0
widgetuser-edit.html
...gitgud/Dashboard/templates/Dashboard/widgetuser-edit.html
+2
-0
urls.py
widget_gitgud/Dashboard/urls.py
+4
-1
views.py
widget_gitgud/Dashboard/views.py
+31
-11
settings.py
widget_gitgud/widget_gitgud/settings.py
+1
-1
No files found.
widget_gitgud/Dashboard/models.py
View file @
54fc5450
...
...
@@ -17,3 +17,7 @@ class WidgetUser(models.Model):
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
first_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'Dashboard:user_details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
\ No newline at end of file
widget_gitgud/Dashboard/templates/Dashboard/dashboard.html
0 → 100644
View file @
54fc5450
{% extends 'base.html' %}
{% load static %}
\ No newline at end of file
widget_gitgud/Dashboard/templates/Dashboard/widgetuser-add.html
0 → 100644
View file @
54fc5450
{% extends 'base.html' %}
{% load static %}
\ No newline at end of file
widget_gitgud/Dashboard/templates/Dashboard/widgetuser-details.html
0 → 100644
View file @
54fc5450
{% extends 'base.html' %}
{% load static %}
\ No newline at end of file
widget_gitgud/Dashboard/templates/Dashboard/widgetuser-edit.html
0 → 100644
View file @
54fc5450
{% extends 'base.html' %}
{% load static %}
\ No newline at end of file
widget_gitgud/Dashboard/urls.py
View file @
54fc5450
...
...
@@ -2,7 +2,10 @@ from django.urls import path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
'dashboard/'
,
views
.
dashboard_view
,
name
=
'dashboard'
),
path
(
'widgetusers/<int:user_id>/details/'
,
views
.
userdetails_view
.
as_view
(),
name
=
'user_details'
),
path
(
'widgetusers/add'
,
views
.
adduser_view
.
as_view
(),
name
=
'add_users'
),
path
(
'widgetusers/<int:pk>/edit/'
,
views
.
edituser_view
.
as_view
(),
name
=
'edit_user'
),
]
app_name
=
"Dashboard"
\ No newline at end of file
widget_gitgud/Dashboard/views.py
View file @
54fc5450
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
django.shortcuts
import
HttpResponse
from
django.views
import
View
from
.models
import
Department
,
WidgetUser
def
index
(
request
):
return_string
=
'<ul>'
for
user
in
WidgetUser
.
objects
.
all
():
return_string
+=
'<li>{}, {} {}: {}, {}</li>'
.
format
(
user
.
last_name
,
user
.
first_name
,
user
.
middle_name
,
user
.
department
,
user
.
department
.
home_unit
)
return_string
+=
'</ul>'
html_string
=
'<html><head>Welcome to Widget!<br> <br> WIDGET USERS:</head><body>{}</body><html>'
.
format
(
return_string
)
def
homepage_view
(
request
):
return
render
(
request
,
'Dashboard/dashboard.html'
)
class
userdetails_view
(
View
):
def
get
(
self
,
request
,
user_id
):
try
:
user
=
WidgetUser
.
objects
.
get
(
pk
=
user_id
)
except
WidgetUser
.
DoesNotExist
:
raise
Http404
(
"User Does Not Exist"
)
users
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
for
person
in
users
:
if
person
.
id
==
user_id
:
user
=
person
break
context
=
{
"user"
:
user
,
"user_id"
:
user_id
}
return
render
(
request
,
'Dashboard/widgetuser-details.html'
,
context
)
class
adduser_view
(
CreateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'Dashboard/widgetuser-add.html'
return
HttpResponse
(
html_string
)
\ No newline at end of file
class
edituser_view
(
UpdateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'Dashboard/widgetuser-edit.html'
\ No newline at end of file
widget_gitgud/widget_gitgud/settings.py
View file @
54fc5450
...
...
@@ -62,7 +62,7 @@ ROOT_URLCONF = 'widget_gitgud.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'template'
)
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment