Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_robo_mommy
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Raul Jarod Conanan
midterm_robo_mommy
Commits
53bd3053
Commit
53bd3053
authored
May 11, 2023
by
RJC
Browse files
Options
Browse Files
Download
Plain Diff
pull changes from master
parents
1bedf6b3
dd4d2812
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
135 additions
and
6 deletions
+135
-6
models.py
widget_robo_mommy/Dashboard/models.py
+15
-1
urls.py
widget_robo_mommy/Dashboard/urls.py
+10
-2
views.py
widget_robo_mommy/Dashboard/views.py
+44
-2
db.sqlite3
widget_robo_mommy/db.sqlite3
+0
-0
base.html
widget_robo_mommy/templates/base.html
+12
-0
widgetuser-add.html
widget_robo_mommy/templates/widgetuser-add.html
+20
-0
widgetuser-details.html
widget_robo_mommy/templates/widgetuser-details.html
+16
-0
widgetuser-edit.html
widget_robo_mommy/templates/widgetuser-edit.html
+15
-0
settings.py
widget_robo_mommy/widget_robo_mommy/settings.py
+2
-1
urls.py
widget_robo_mommy/widget_robo_mommy/urls.py
+1
-0
No files found.
widget_robo_mommy/Dashboard/models.py
View file @
53bd3053
from
django.db
import
models
from
django.urls
import
reverse
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
50
)
home_unit
=
models
.
CharField
(
max_length
=
100
)
def
__str__
(
self
)
->
str
:
return
str
(
self
.
dept_name
)
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
50
)
middle_name
=
models
.
CharField
(
max_length
=
50
)
last_name
=
models
.
CharField
(
max_length
=
50
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
)
\ No newline at end of file
department
=
models
.
ForeignKey
(
Department
,
related_name
=
"department"
,
on_delete
=
models
.
CASCADE
)
def
get_absolute_url
(
self
):
return
reverse
(
'widgetuser-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_absolute_url
(
self
):
return
reverse
(
'widgetuser-add'
,
kwargs
=
{
'pk'
:
self
.
pk
})
\ No newline at end of file
widget_robo_mommy/Dashboard/urls.py
View file @
53bd3053
from
django.urls
import
path
from
.views
import
Dashboard_list_view
from
.views
import
(
Dashboard_list_view
,
WidgetUserDetailView
,
WidgetUserAddView
,
WidgetUserUpdateView
)
urlpatterns
=
[
path
(
''
,
Dashboard_list_view
,
name
=
'Dashboard_list_view'
),
path
(
'Dashboard/'
,
Dashboard_list_view
,
name
=
'Dashboard_list_view'
),
path
(
'Widgetusers/<int:pk>/details'
,
WidgetUserDetailView
.
as_view
(),
name
=
'widgetuser-detail'
),
path
(
'Widgetusers/add/'
,
WidgetUserAddView
.
as_view
(),
name
=
'widgetuser-add'
),
path
(
'Widgetusers/<int:pk>/edit/'
,
WidgetUserUpdateView
.
as_view
(),
name
=
'widgetuser-edit'
)
]
app_name
=
"Dashboard"
\ No newline at end of file
widget_robo_mommy/Dashboard/views.py
View file @
53bd3053
import
string
from
.models
import
WidgetUser
,
Department
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views
import
generic
from
django.urls
import
reverse
def
Dashboard_list_view
(
request
):
...
...
@@ -9,12 +14,49 @@ def Dashboard_list_view(request):
'<h2>WIDGET USERS</h2></head><ul>'
html_string_2
=
''
for
wu
in
WidgetUser
.
objects
.
all
():
html_string_2
+=
'<li>{}, {} {}: {}, {}'
.
format
(
wu
.
last_name
,
number
=
str
(
wu
.
pk
)
href
=
'<a href="/Widgetusers/'
+
number
+
'/details">'
html_string_2
+=
'<li>'
+
href
+
'{}, {} {}: {}, {}'
.
format
(
wu
.
last_name
,
wu
.
first_name
,
wu
.
middle_name
,
wu
.
department
.
dept_name
,
wu
.
department
.
home_unit
)
html_string_2
+=
'</ul></li>'
html_string_final
=
html_string_1
+
html_string_2
+
'</html>'
html_string_3
=
'<a href="/Widgetusers/add"><button value="click here" > Add Widget User</button></a><br><br>'
html_string_3
+=
'<a href="/Announcements/">Announcement Board</a><br>'
html_string_3
+=
'<a href="/Forum/">Forum</a><br>'
html_string_3
+=
'<a href="/Assignments">Assignment</a><br>'
html_string_3
+=
'<a href="/Calendar/">Calendar</a><br>'
html_string_final
=
html_string_1
+
html_string_2
+
html_string_3
+
'</html>'
return
HttpResponse
(
html_string_final
)
class
WidgetUserDetailView
(
generic
.
DetailView
):
model
=
WidgetUser
template_name
=
'widgetuser-details.html'
queryset
=
WidgetUser
.
objects
.
all
()
context_object_name
=
'widgetuser-detail'
class
WidgetUserAddView
(
generic
.
CreateView
):
model
=
WidgetUser
fields
=
'__all__'
template_name
=
'widgetuser-add.html'
def
get_success_url
(
self
):
return
reverse
(
'Dashboard:widgetuser-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
id
},
current_app
=
self
.
request
.
resolver_match
.
namespace
)
class
WidgetUserUpdateView
(
generic
.
UpdateView
):
model
=
WidgetUser
template_name
=
'widgetuser-edit.html'
fields
=
'__all__'
success_url
=
"Dashboard/"
def
get_success_url
(
self
):
return
reverse
(
'Dashboard:widgetuser-detail'
,
kwargs
=
{
'pk'
:
self
.
object
.
id
},
current_app
=
self
.
request
.
resolver_match
.
namespace
)
\ No newline at end of file
widget_robo_mommy/db.sqlite3
View file @
53bd3053
No preview for this file type
widget_robo_mommy/templates/base.html
0 → 100644
View file @
53bd3053
<!DOCTYPE html>
<html>
<body>
{% block content %}
{% endblock content %}
<br>
</body>
</html>
\ No newline at end of file
widget_robo_mommy/templates/widgetuser-add.html
0 → 100644
View file @
53bd3053
{% extends "base.html" %}
{% load static %}
{% block content %}
<h1>
Add Widget User
</h1>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<a
href=
"/Widgetusers/{{WidgetUser.pk}}/details"
>
<button
type=
"submit"
>
Add Widget User
</button>
</a>
</form>
{% endblock content %}
\ No newline at end of file
widget_robo_mommy/templates/widgetuser-details.html
0 → 100644
View file @
53bd3053
{% extends "base.html" %}
{% load static %}
{% block content %}
<title>
Widget User
</title>
<br><br>
<h2>
{{object.first_name}} {{object.middle_name}} {{object.last_name}}
</h2>
<h3>
{{object.department}}
</h3>
<h3>
{{object.department.home_unit}}
</h3>
<a
href=
"/Widgetusers/{{ object.id }}/edit"
>
<input
type=
"button"
value=
"Edit Widget User"
>
</a>
"
{% endblock content %}
\ No newline at end of file
widget_robo_mommy/templates/widgetuser-edit.html
0 → 100644
View file @
53bd3053
{% extends "base.html" %}
{% load static %}
{% block content %}
<h1>
Edit Widget User
</h1>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Edit Widget User"
/>
</a>
</form>
{% endblock content %}
\ No newline at end of file
widget_robo_mommy/widget_robo_mommy/settings.py
View file @
53bd3053
...
...
@@ -66,7 +66,8 @@ ROOT_URLCONF = 'widget_robo_mommy.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
),
'widget_robo_mommy/templates'
],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
widget_robo_mommy/widget_robo_mommy/urls.py
View file @
53bd3053
...
...
@@ -20,6 +20,7 @@ from django.urls import include, path
urlpatterns
=
[
path
(
'announcements/'
,
include
(
'announcements.urls'
,
namespace
=
"announcements"
)),
path
(
'widget_Calendar/'
,
include
(
'widget_Calendar.urls'
,
namespace
=
"widget_Calendar"
)),
path
(
''
,
include
(
'Dashboard.urls'
,
namespace
=
"Dashboard"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'Assignments/'
,
include
(
'Assignments.urls'
,
namespace
=
"Assignments"
)),
path
(
''
,
include
((
'forum.urls'
,
'forum'
),
namespace
=
'forum'
)),
...
...
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