Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_TypeWriterMonkeyCSCIMoment
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
Jose Leonardo J. Sacamos III
widget_TypeWriterMonkeyCSCIMoment
Commits
fc46209f
Commit
fc46209f
authored
May 22, 2022
by
Teo Quinto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed index from FBV to CBV
parent
8781eaa5
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
7 deletions
+21
-7
forms.cpython-310.pyc
...nkeyCSCIMoment/homepage/__pycache__/forms.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
...onkeyCSCIMoment/homepage/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...nkeyCSCIMoment/homepage/__pycache__/views.cpython-310.pyc
+0
-0
widgetuser_list.html
...CIMoment/homepage/templates/homepage/widgetuser_list.html
+17
-0
urls.py
widget_TypeWriterMonkeyCSCIMoment/homepage/urls.py
+1
-1
views.py
widget_TypeWriterMonkeyCSCIMoment/homepage/views.py
+3
-6
No files found.
widget_TypeWriterMonkeyCSCIMoment/homepage/__pycache__/forms.cpython-310.pyc
View file @
fc46209f
No preview for this file type
widget_TypeWriterMonkeyCSCIMoment/homepage/__pycache__/urls.cpython-310.pyc
View file @
fc46209f
No preview for this file type
widget_TypeWriterMonkeyCSCIMoment/homepage/__pycache__/views.cpython-310.pyc
View file @
fc46209f
No preview for this file type
widget_TypeWriterMonkeyCSCIMoment/homepage/templates/homepage/
index
.html
→
widget_TypeWriterMonkeyCSCIMoment/homepage/templates/homepage/
widgetuser_list
.html
View file @
fc46209f
...
...
@@ -5,15 +5,13 @@
{% block content %}
<h1>
Welcome to Widget!
</h1>
<p>
Widget Users:
</p>
{% if users %}
<ol>
{% for user in users %}
<li><a
href=
"users/{{ user.id }}/details/"
>
{{ user.last_name }},
{{ user.first_name }} {{ user.middle_name }}
</a></li>
<ol>
{% for object in object_list %}
<li><a
href=
"users/{{ object.id }}/details/"
>
{{ object.last_name }},
{{ object.first_name }} {{ object.middle_name }}
</a></li>
{% empty %}
<li>
No users registered.
</li>
{% endfor %}
</ol>
{% else %}
<p>
No users are available
</p>
{% endif %}
</ol>
<button
onclick=
"window.location.href='users/add/';"
>
Add Widget User
</button>
{% endblock %}
\ No newline at end of file
widget_TypeWriterMonkeyCSCIMoment/homepage/urls.py
View file @
fc46209f
...
...
@@ -3,7 +3,7 @@ from django.urls import path
from
.
import
views
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'index'
),
path
(
''
,
views
.
IndexView
.
as_view
()
,
name
=
'index'
),
# homepage/users/1/details/
path
(
"users/<int:user_id>/details/"
,
views
.
details
,
name
=
"details"
),
# homepage/users/add/
...
...
widget_TypeWriterMonkeyCSCIMoment/homepage/views.py
View file @
fc46209f
from
django.http
import
Http404
,
HttpResponse
from
django.shortcuts
import
render
,
redirect
from
django.views.generic.list
import
ListView
from
.models
import
Department
,
WidgetUser
from
.forms
import
WidgetUserForm
# Create your views here.
def
index
(
request
):
users
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
context
=
{
"users"
:
users
,
}
return
render
(
request
,
"homepage/index.html"
,
context
)
class
IndexView
(
ListView
):
queryset
=
WidgetUser
.
objects
.
order_by
(
"last_name"
)
def
details
(
request
,
user_id
):
try
:
...
...
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