Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Francoconuts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Chester Tan
widget_Francoconuts
Commits
bbb1efd5
Commit
bbb1efd5
authored
May 23, 2022
by
Bryan Carlo Guanlao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://gitlab.discs.ateneo.edu/chesterpogi/widget_Francoconuts
parents
e1e5857b
3a15f67f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
3 deletions
+33
-3
models.py
widget_Francoconuts/homepage/models.py
+5
-0
widgetuser_detail.html
...conuts/homepage/templates/homepage/widgetuser_detail.html
+3
-0
widgetuser_form.html
...coconuts/homepage/templates/homepage/widgetuser_form.html
+11
-0
widgetuser_list.html
...coconuts/homepage/templates/homepage/widgetuser_list.html
+3
-0
urls.py
widget_Francoconuts/homepage/urls.py
+3
-2
views.py
widget_Francoconuts/homepage/views.py
+8
-1
No files found.
widget_Francoconuts/homepage/models.py
View file @
bbb1efd5
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
class
Department
(
models
.
Model
):
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
30
)
dept_name
=
models
.
CharField
(
max_length
=
30
)
...
@@ -20,3 +22,6 @@ class WidgetUser(models.Model):
...
@@ -20,3 +22,6 @@ class WidgetUser(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
f
"{self.first_name} {self.middle_name} {self.last_name}"
return
f
"{self.first_name} {self.middle_name} {self.last_name}"
def
get_absolute_url
(
self
):
return
reverse
(
'homepage:widgetuser-list'
)
widget_Francoconuts/homepage/templates/homepage/widgetuser_detail.html
View file @
bbb1efd5
{% block content %}
{% block content %}
<li>
<a
href=
"{% url 'homepage:widgetuser-list' %}"
>
Homepage
</a>
</li>
<ul>
<ul>
<li>
Complete Name: {{widgetuser.last_name}}, {{widgetuser.first_name}} {{widgetuser.middle_name}}
</li>
<li>
Complete Name: {{widgetuser.last_name}}, {{widgetuser.first_name}} {{widgetuser.middle_name}}
</li>
<li>
{{widgetuser.id_num}}
</li>
<li>
{{widgetuser.id_num}}
</li>
...
...
widget_Francoconuts/homepage/templates/homepage/widgetuser_form.html
0 → 100644
View file @
bbb1efd5
{% block content %}
<li>
<a
href=
"{% url 'homepage:widgetuser-list' %}"
>
Homepage
</a>
</li>
<h1>
Add Widget User
</h1>
<form
method=
"post"
>
{% csrf_token %}
{{ form }}
<input
type=
"submit"
value=
"Save New User"
>
</form>
{% endblock content %}
widget_Francoconuts/homepage/templates/homepage/widgetuser_list.html
View file @
bbb1efd5
...
@@ -10,5 +10,8 @@
...
@@ -10,5 +10,8 @@
</a>
</a>
</body>
</body>
{% endfor %}
{% endfor %}
<a
href=
"{% url 'homepage:widgetuser-create' %}"
>
<br>
Add Widget User
</a>
</ul>
</ul>
{% endblock content%}
{% endblock content%}
widget_Francoconuts/homepage/urls.py
View file @
bbb1efd5
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
WidgetUserListView
,
WidgetUserDetailView
from
.views
import
WidgetUserListView
,
WidgetUserDetailView
,
WidgetUserCreateView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
WidgetUserListView
.
as_view
(),
name
=
'widgetuser-list'
),
path
(
''
,
WidgetUserListView
.
as_view
(),
name
=
'widgetuser-list'
),
path
(
'users/<str:id_num>/details/'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser-detail'
)
path
(
'users/<str:id_num>/details/'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser-detail'
),
path
(
'users/add/'
,
WidgetUserCreateView
.
as_view
(),
name
=
'widgetuser-create'
)
]
]
app_name
=
'homepage'
app_name
=
'homepage'
widget_Francoconuts/homepage/views.py
View file @
bbb1efd5
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
,
redirect
from
.models
import
Department
,
WidgetUser
from
.models
import
Department
,
WidgetUser
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
from
django.views.generic.edit
import
CreateView
class
WidgetUserListView
(
ListView
):
class
WidgetUserListView
(
ListView
):
model
=
WidgetUser
model
=
WidgetUser
...
@@ -10,3 +13,7 @@ class WidgetUserDetailView(DetailView):
...
@@ -10,3 +13,7 @@ class WidgetUserDetailView(DetailView):
model
=
WidgetUser
model
=
WidgetUser
def
get_object
(
self
,
queryset
=
None
):
def
get_object
(
self
,
queryset
=
None
):
return
WidgetUser
.
objects
.
get
(
id_num
=
self
.
kwargs
.
get
(
"id_num"
))
return
WidgetUser
.
objects
.
get
(
id_num
=
self
.
kwargs
.
get
(
"id_num"
))
class
WidgetUserCreateView
(
CreateView
):
model
=
WidgetUser
fields
=
'__all__'
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