Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
midterm_OhMyBash
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
Nheo Samson
midterm_OhMyBash
Commits
f08eca11
Commit
f08eca11
authored
May 14, 2023
by
nheoxoz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'origin/dashboardv2'
parents
b357a962
04831701
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
117 additions
and
10 deletions
+117
-10
models.py
widget_OhMyBash/dashboard/models.py
+4
-0
dashboard.html
widget_OhMyBash/dashboard/templates/dashboard/dashboard.html
+23
-0
widgetuser-add.html
...hMyBash/dashboard/templates/dashboard/widgetuser-add.html
+14
-0
widgetuser-details.html
...ash/dashboard/templates/dashboard/widgetuser-details.html
+23
-0
widgetuser-edit.html
...MyBash/dashboard/templates/dashboard/widgetuser-edit.html
+14
-0
urls.py
widget_OhMyBash/dashboard/urls.py
+14
-2
views.py
widget_OhMyBash/dashboard/views.py
+24
-7
urls.py
widget_OhMyBash/widget_OhMyBash/urls.py
+1
-1
No files found.
widget_OhMyBash/dashboard/models.py
View file @
f08eca11
from
django.db
import
models
from
django.urls
import
reverse
class
Department
(
models
.
Model
):
...
...
@@ -21,3 +22,6 @@ class WidgetUser(models.Model):
self
.
first_name
,
self
.
middle_name
)
def
get_absolute_url
(
self
):
return
reverse
(
'dashboard:widgetuser-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
widget_OhMyBash/dashboard/templates/dashboard/dashboard.html
0 → 100644
View file @
f08eca11
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget v2{% endblock %}
{% block heading %}Welcome to Widget!{% endblock %}
{% block content %}
<p>
WIDGET USERS:
<br>
{% for user in users %}
<a
href=
"{{ user.get_absolute_url }}"
>
{{ user.last_name }}, {{ user.first_name }}
</a><br>
{% endfor %}
</p>
{% endblock %}
{% block footing %}
<a
href=
"{% url 'dashboard:widgetuser-create' %}"
>
<button
class=
"btn add"
>
Add Widget User
</button>
</a>
{% endblock %}
\ No newline at end of file
widget_OhMyBash/dashboard/templates/dashboard/widgetuser-add.html
0 → 100644
View file @
f08eca11
{% extends 'base.html' %}
{% load static %}
{% block title %}Add Widget User{% endblock %}
{% block heading %}
<h1>
Add a new Widget User:
</h1>
{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Add Widget User"
>
</form>
{% endblock %}
\ No newline at end of file
widget_OhMyBash/dashboard/templates/dashboard/widgetuser-details.html
0 → 100644
View file @
f08eca11
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.last_name }}, {{ object.first_name }}{% endblock %}
{% block heading %}
<h1>
{{ object.first_name }} {{ object.middle_name }} {{ object.last_name }}
</h1>
{% endblock %}
{% block content %}
<p>
{{ object.department.dept_name }}
<br>
{{ object.department.home_unit }}
<br>
</p>
{% endblock %}
{% block footing %}
<a
href=
"{% url 'dashboard:widgetuser-update' object.pk %}"
>
<button
class=
"btn edit"
>
Edit Widget User
</button>
</a>
{% endblock %}
\ No newline at end of file
widget_OhMyBash/dashboard/templates/dashboard/widgetuser-edit.html
0 → 100644
View file @
f08eca11
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Widget User{% endblock %}
{% block heading %}Edit Widget User:{% endblock %}
{% block content %}
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save Changes to Widget User"
>
</form>
{% endblock %}
\ No newline at end of file
widget_OhMyBash/dashboard/urls.py
View file @
f08eca11
from
django.urls
import
path
from
.views
import
index
from
.views
import
(
dashboard
,
WidgetUserDetailView
,
WidgetUserCreateView
,
WidgetUserUpdateView
)
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
'dashboard/'
,
dashboard
,
name
=
'dashboard'
),
path
(
'widgetusers/<int:pk>/details/'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser-details'
),
path
(
'widgetusers/add/'
,
WidgetUserCreateView
.
as_view
(),
name
=
'widgetuser-create'
),
path
(
'widgetusers/<int:pk>/edit/'
,
WidgetUserUpdateView
.
as_view
(),
name
=
'widgetuser-update'
),
]
app_name
=
"dashboard"
widget_OhMyBash/dashboard/views.py
View file @
f08eca11
from
django.shortcuts
import
HttpResponse
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
WidgetUser
def
index
(
request
):
return_string
=
'<p>Welcome to Widget!</p>WIDGET USERS:<br>'
for
user
in
WidgetUser
.
objects
.
all
():
return_string
+=
'{}: {}<br>'
.
format
(
user
,
user
.
department
)
html_string
=
'<html><body>{}</body></html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
def
dashboard
(
request
):
users
=
WidgetUser
.
objects
.
all
()
return
render
(
request
,
'dashboard/dashboard.html'
,
{
'users'
:
users
})
class
WidgetUserDetailView
(
DetailView
):
model
=
WidgetUser
template_name
=
'dashboard/widgetuser-details.html'
class
WidgetUserCreateView
(
CreateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-add.html'
class
WidgetUserUpdateView
(
UpdateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'dashboard/widgetuser-edit.html'
widget_OhMyBash/widget_OhMyBash/urls.py
View file @
f08eca11
...
...
@@ -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
(
'forum/'
,
include
(
'forum.urls'
,
namespace
=
"forum"
)),
path
(
'announcements/'
,
include
(
'announcements.urls'
,
namespace
=
"announcements"
)),
path
(
'widget_calendar/'
,
include
(
'widget_calendar.urls'
,
namespace
=
"calendar"
)),
...
...
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