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
d8225ce7
Commit
d8225ce7
authored
May 11, 2023
by
RJC
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1-Forum' of
https://gitlab.discs.ateneo.edu/RJC/midterm_robo_mommy
into 1-Forumv2
parents
8ebdf69e
e28efc8e
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
155 additions
and
7 deletions
+155
-7
0003_alter_widgetuser_department.py
.../Dashboard/migrations/0003_alter_widgetuser_department.py
+19
-0
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
+2
-1
No files found.
widget_robo_mommy/Dashboard/migrations/0003_alter_widgetuser_department.py
0 → 100644
View file @
d8225ce7
# Generated by Django 3.2 on 2023-05-11 11:03
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Dashboard'
,
'0002_widgetuser'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'widgetuser'
,
name
=
'department'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'department'
,
to
=
'Dashboard.department'
),
),
]
widget_robo_mommy/Dashboard/models.py
View file @
d8225ce7
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 @
d8225ce7
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 @
d8225ce7
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 @
d8225ce7
No preview for this file type
widget_robo_mommy/templates/base.html
0 → 100644
View file @
d8225ce7
<!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 @
d8225ce7
{% 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 @
d8225ce7
{% 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 @
d8225ce7
{% 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 @
d8225ce7
...
...
@@ -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 @
d8225ce7
...
...
@@ -20,8 +20,9 @@ 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'
)),
path
(
'Dashboard/'
,
include
(
'Dashboard.urls'
,
namespace
=
"Dashboard"
)),
#
path('Dashboard/', include('Dashboard.urls', namespace="Dashboard")),
]
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