Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_father when can i be on my own i have the hello world to see
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
father when can i be on my own i have the hello world to see
widget_father when can i be on my own i have the hello world to see
Commits
792cebf9
Commit
792cebf9
authored
May 23, 2022
by
Charles Lim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set up URLs with new cbv
parent
85d51030
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
widgetuser_form.html
homepage/templates/homepage/widgetuser_form.html
+1
-3
urls.py
homepage/urls.py
+3
-1
views.py
homepage/views.py
+5
-3
No files found.
homepage/templates/homepage/widgetuser_form.html
View file @
792cebf9
...
@@ -13,7 +13,5 @@
...
@@ -13,7 +13,5 @@
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
<p>
Student ID: {{object.id_num}}
</p>
{{form.as_p}}
<p>
Email: {{object.email}}
</p>
<p>
Department and Course: {{object.department.home_unit}}, {{object.department.dept_name}}
</p>
{% endblock %}
{% endblock %}
\ No newline at end of file
homepage/urls.py
View file @
792cebf9
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
HomepageView
,
WidgetUserDetailView
from
.views
import
HomepageView
,
WidgetUserDetailView
,
WidgetUserCreateView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
HomepageView
.
as_view
(),
name
=
'index'
),
path
(
''
,
HomepageView
.
as_view
(),
name
=
'index'
),
path
(
'<int:pk>/details'
,
WidgetUserDetailView
.
as_view
(),
path
(
'<int:pk>/details'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser_detail'
),
name
=
'widgetuser_detail'
),
path
(
'users/add'
,
WidgetUserCreateView
.
as_view
(),
name
=
'widgetuser_form'
),
]
]
app_name
=
"homepage"
app_name
=
"homepage"
homepage/views.py
View file @
792cebf9
...
@@ -5,7 +5,7 @@ from django.views.generic.detail import DetailView
...
@@ -5,7 +5,7 @@ from django.views.generic.detail import DetailView
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
CreateView
from
.models
import
WidgetUser
from
.models
import
WidgetUser
# Homepage Index View
class
HomepageView
(
View
):
class
HomepageView
(
View
):
def
get
(
self
,
request
):
def
get
(
self
,
request
):
objects_set
=
{
objects_set
=
{
...
@@ -13,10 +13,12 @@ class HomepageView(View):
...
@@ -13,10 +13,12 @@ class HomepageView(View):
}
}
return
render
(
request
,
'homepage/index.html'
,
objects_set
)
return
render
(
request
,
'homepage/index.html'
,
objects_set
)
# WidgetUser Detail View
class
WidgetUserDetailView
(
DetailView
):
class
WidgetUserDetailView
(
DetailView
):
model
=
WidgetUser
model
=
WidgetUser
# WidgetUser Create View
class
WidgetUserCreateView
(
CreateView
):
class
WidgetUserCreateView
(
CreateView
):
model
=
WidgetUser
model
=
WidgetUser
fields
=
[
"first_name"
,
"middle_name"
,
"last_name"
,
"id_num"
,
"email"
,
"profile_pic"
,
"department"
]
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