Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_appappandaway
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
Ian Rafael T. Aragoza
midterm_appappandaway
Commits
1a47773a
Commit
1a47773a
authored
May 12, 2023
by
Ian Rafael T. Aragoza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added pages for user details, editing, and adding
parent
318e225a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
144 additions
and
12 deletions
+144
-12
forms.py
widget_appappandaway/dashboard/forms.py
+8
-0
dashboard.html
...ppappandaway/dashboard/templates/dashboard/dashboard.html
+3
-3
widgetuser-add.html
...andaway/dashboard/templates/dashboard/widgetuser-add.html
+29
-0
widgetuser-details.html
...way/dashboard/templates/dashboard/widgetuser-details.html
+36
-0
widgetuser-edit.html
...ndaway/dashboard/templates/dashboard/widgetuser-edit.html
+29
-0
urls.py
widget_appappandaway/dashboard/urls.py
+5
-4
views.py
widget_appappandaway/dashboard/views.py
+33
-4
urls.py
widget_appappandaway/widget_appappandaway/urls.py
+1
-1
No files found.
widget_appappandaway/dashboard/forms.py
0 → 100644
View file @
1a47773a
from
django
import
forms
from
.models
import
WidgetUser
class
UserForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
WidgetUser
fields
=
'__all__'
widget_appappandaway/dashboard/templates/dashboard/dashboard.html
View file @
1a47773a
...
...
@@ -11,16 +11,16 @@
<h3
class=
"display-6"
>
Widget Users:
</h3>
<br>
{% for object in object_list %}
<p><a
href=
"{{ object.get_absolute_url }}/details/"
>
{{ object.last_name }}, {{ object.first_name }}
</a></p>
<p><a
href=
"
/widgetusers/
{{ object.get_absolute_url }}/details/"
>
{{ object.last_name }}, {{ object.first_name }}
</a></p>
{% endfor %}
<br><br>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-6"
>
<a
href=
"/widgetusers/add"
><button
type=
"button"
class=
"btn btn-primary"
>
Add Widget User
</button></a>
<a
href=
"
..
/widgetusers/add"
><button
type=
"button"
class=
"btn btn-primary"
>
Add Widget User
</button></a>
</div>
<div
class=
"col-6"
>
<a
href=
"/announcements"
><button
type=
"button"
class=
"btn btn-primary"
>
Announcements
</button></a>
<a
href=
"
..
/announcements"
><button
type=
"button"
class=
"btn btn-primary"
>
Announcements
</button></a>
</div>
</div>
</div>
...
...
widget_appappandaway/dashboard/templates/dashboard/widgetuser-add.html
0 → 100644
View file @
1a47773a
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Author{% endblock %}
{% block content %}
{{ form.non_field_errors }}
<div
class=
"container-fluid p-3 bg-dark text-white text-center"
>
<br>
<h1
class=
"display-4"
>
Add a New Widget User
</h1>
<br>
</div>
<div
class=
"container my-5 text-center"
>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{ field.label }}
<br>
{{ field }}
<br><br>
{% endfor %}
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-6"
>
<a
href=
"/dashboard"
><button
type=
"button"
class=
"btn btn-primary"
>
Cancel Widget User
</button></a>
</div>
<div
class=
"col-6"
>
<input
type=
"submit"
value=
"Add Widget User"
class=
"btn btn-primary"
href=
"/books/{{ object.pk }}/edit"
>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
widget_appappandaway/dashboard/templates/dashboard/widgetuser-details.html
0 → 100644
View file @
1a47773a
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.last_name }}, {{ object.first_name }}{% endblock %}
{% block content %}
<div
class=
"container-fluid p-4 bg-dark text-white text-center"
>
<h1>
{{ object.first_name }} {{object.middle_name}} {{ object.last_name }}
</h1>
<br>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-2"
>
</div>
<div
class=
"col-4"
>
<p>
Department: {{ object.department }}
</p>
</div>
<div
class=
"col-4"
>
<p>
Home Unit: {{ object.department.home_unit }}
</p>
</div>
<div
class=
"col-2"
>
</div>
</div>
</div>
<a
href=
"/widgetusers/{{ object.pk }}/edit/"
class=
"btn btn-primary"
>
Edit Author
</a>
</div>
<div
class=
"container my-4 text-center"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-6"
>
<a
href=
"/dashboard"
><button
type=
"button"
class=
"btn btn-primary"
>
Dashboard
</button></a>
</div>
<div
class=
"col-6"
>
<a
href=
"/Announcements"
><button
type=
"button"
class=
"btn btn-primary"
>
Announcements
</button></a>
</div>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_appappandaway/dashboard/templates/dashboard/widgetuser-edit.html
0 → 100644
View file @
1a47773a
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Author{% endblock %}
{% block content %}
{{ form.non_field_errors }}
<div
class=
"container-fluid p-3 bg-dark text-white text-center"
>
<br>
<h1
class=
"display-4"
>
Edit Widget User
</h1>
<br>
</div>
<div
class=
"container my-5 text-center"
>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
{{ field.label }}
<br>
{{ field }}
<br><br>
{% endfor %}
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-6"
>
<a
href=
"/dashboard"
><button
type=
"button"
class=
"btn btn-primary"
>
Cancel Changes to Widget User
</button></a>
</div>
<div
class=
"col-6"
>
<input
type=
"submit"
value=
"Save Changes to Widget User"
class=
"btn btn-primary"
href=
"/books/{{ object.pk }}/edit"
>
</div>
</div>
</div>
</form>
</div>
{% endblock %}
widget_appappandaway/dashboard/urls.py
View file @
1a47773a
from
django.shortcuts
import
render
from
django.urls
import
path
from
.views
import
dashboard
,
addUser
,
userDetails
from
.views
import
dashboard
,
WidgetUserDetailView
,
WidgetUserCreateView
,
WidgetUserUpdateView
# Create your views here.
urlpatterns
=
[
path
(
''
,
dashboard
,
name
=
'index'
),
path
(
'widgetusers/add/'
,
addUser
,
name
=
'add-user'
),
path
(
'widgetusers/<int:pk>/details/'
,
userDetails
,
name
=
'user-details'
),
path
(
'dashboard/'
,
dashboard
,
name
=
'dashboard'
),
path
(
'widgetusers/<int:pk>/details/'
,
WidgetUserDetailView
.
as_view
(),
name
=
'user-details'
),
path
(
'widgetusers/add/'
,
WidgetUserCreateView
.
as_view
(),
name
=
'add-user'
),
path
(
'widgetusers/<int:pk>/edit/'
,
WidgetUserUpdateView
.
as_view
(),
name
=
'edit-user'
),
]
app_name
=
"dashboard"
widget_appappandaway/dashboard/views.py
View file @
1a47773a
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http.response
import
HttpResponseRedirect
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
WidgetUser
from
.forms
import
UserForm
# Create your views here.
...
...
@@ -12,8 +16,33 @@ def dashboard(request):
}
return
render
(
request
,
'dashboard/dashboard.html'
,
context
)
def
addUser
(
request
):
return
render
(
request
,
'dashboard.html'
)
def
userDetails
(
request
):
return
render
(
request
,
'dashboard.html'
)
class
WidgetUserDetailView
(
DetailView
):
model
=
WidgetUser
template_name
=
'dashboard/widgetuser-details.html'
class
WidgetUserCreateView
(
CreateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-add.html'
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
form
=
UserForm
(
request
.
POST
)
if
form
.
is_valid
():
new_user
=
form
.
save
()
redirect_link
=
"../"
+
new_user
.
get_absolute_url
()
+
"/details/"
return
HttpResponseRedirect
(
redirect_link
)
else
:
return
render
(
request
,
self
.
template_name
,
{
'form'
:
form
})
class
WidgetUserUpdateView
(
UpdateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-edit.html'
success_url
=
"../details/"
widget_appappandaway/widget_appappandaway/urls.py
View file @
1a47773a
...
...
@@ -17,7 +17,7 @@ from django.contrib import admin
from
django.urls
import
include
,
path
urlpatterns
=
[
path
(
'
dashboard/
'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
''
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
'announcements/'
,
include
(
'announcementboard.urls'
,
namespace
=
"announcements"
)),
path
(
'forum/'
,
include
(
'forum.urls'
,
namespace
=
"forum"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
...
...
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