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
0e90f3f3
Commit
0e90f3f3
authored
May 12, 2023
by
Jiuvi Anne Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://gitlab.discs.ateneo.edu/RJC/midterm_robo_mommy
into announcementsv2
Merge to avoid conflicts later.
parents
513eb96c
b4aaf490
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
145 additions
and
26 deletions
+145
-26
apps.py
widget_robo_mommy/Assignments/apps.py
+1
-1
forms.py
widget_robo_mommy/Assignments/forms.py
+24
-0
0002_alter_assignment_course.py
...my/Assignments/migrations/0002_alter_assignment_course.py
+2
-2
models.py
widget_robo_mommy/Assignments/models.py
+13
-0
urls.py
widget_robo_mommy/Assignments/urls.py
+8
-2
views.py
widget_robo_mommy/Assignments/views.py
+27
-14
views.py
widget_robo_mommy/Dashboard/views.py
+1
-1
assignment-add.html
...mmy/assignments/templates/assignments/assignment-add.html
+13
-0
assignment-details.html
...assignments/templates/assignments/assignment-details.html
+17
-0
assignment-edit.html
...my/assignments/templates/assignments/assignment-edit.html
+13
-0
assignments.html
..._mommy/assignments/templates/assignments/assignments.html
+20
-0
forum.html
widget_robo_mommy/forum/templates/forum/forum.html
+1
-1
0003_alter_event_course.py
...mmy/widget_Calendar/migrations/0003_alter_event_course.py
+2
-2
models.py
widget_robo_mommy/widget_Calendar/models.py
+1
-1
settings.py
widget_robo_mommy/widget_robo_mommy/settings.py
+1
-1
urls.py
widget_robo_mommy/widget_robo_mommy/urls.py
+1
-1
No files found.
widget_robo_mommy/Assignments/apps.py
View file @
0e90f3f3
...
...
@@ -3,4 +3,4 @@ from django.apps import AppConfig
class
AssignmentsConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'
A
ssignments'
name
=
'
a
ssignments'
widget_robo_mommy/Assignments/forms.py
0 → 100644
View file @
0e90f3f3
from
django.forms
import
ModelForm
from
.models
import
Assignment
from
django
import
forms
class
AssignmentForm
(
ModelForm
):
class
Meta
:
model
=
Assignment
fields
=
"__all__"
labels
=
{
'name'
:
''
,
'description'
:
''
,
'course'
:
'Course: '
,
'perfect_score'
:
''
,
}
widgets
=
{
'name'
:
forms
.
TextInput
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Assignment Name'
}),
'description'
:
forms
.
Textarea
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Description'
}),
'course'
:
forms
.
Select
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Course'
}),
'perfect_score'
:
forms
.
NumberInput
(
attrs
=
{
'class'
:
'form-control'
,
'placeholder'
:
'Perfect Score'
}),
'passing_score'
:
forms
.
HiddenInput
(),
}
\ No newline at end of file
widget_robo_mommy/Assignments/migrations/0002_alter_assignment_course.py
View file @
0e90f3f3
...
...
@@ -7,13 +7,13 @@ import django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
A
ssignments'
,
'0001_initial'
),
(
'
a
ssignments'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'assignment'
,
name
=
'course'
,
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
A
ssignments.course'
),
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'
a
ssignments.course'
),
),
]
widget_robo_mommy/Assignments/models.py
View file @
0e90f3f3
from
django.db
import
models
from
django.urls
import
reverse
class
Course
(
models
.
Model
):
...
...
@@ -6,6 +7,9 @@ class Course(models.Model):
title
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
section
=
models
.
CharField
(
max_length
=
3
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
self
.
code
+
'-'
+
self
.
section
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
...
...
@@ -17,3 +21,12 @@ class Assignment(models.Model):
def
save
(
self
,
*
args
,
**
kwargs
):
self
.
passing_score
=
int
(
self
.
perfect_score
*
0.60
)
super
(
Assignment
,
self
)
.
save
(
*
args
,
**
kwargs
)
def
__str__
(
self
):
return
self
.
name
def
get_absolute_url
(
self
):
return
reverse
(
'assignments:assignments-item'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_update_url
(
self
):
return
reverse
(
'assignments:assignments-edit'
,
kwargs
=
{
'pk'
:
self
.
pk
})
widget_robo_mommy/Assignments/urls.py
View file @
0e90f3f3
from
django.urls
import
path
from
.views
import
index
from
.views
import
(
index
,
AssignmentDetailsView
,
AddAssignmentView
,
EditAssignmentView
)
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
'add/'
,
AddAssignmentView
.
as_view
(),
name
=
'assignments-add'
),
path
(
'<int:pk>/edit/'
,
EditAssignmentView
.
as_view
(),
name
=
'assignments-edit'
),
path
(
'<int:pk>/details/'
,
AssignmentDetailsView
.
as_view
(),
name
=
'assignments-item'
),
]
app_name
=
"
A
ssignments"
app_name
=
"
a
ssignments"
widget_robo_mommy/Assignments/views.py
View file @
0e90f3f3
from
django.http
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
Assignment
from
.forms
import
AssignmentForm
class
AssignmentDetailsView
(
DetailView
):
model
=
Assignment
template_name
=
'assignments/assignment-details.html'
class
AddAssignmentView
(
CreateView
):
model
=
Assignment
form_class
=
AssignmentForm
template_name
=
'assignments/assignment-add.html'
class
EditAssignmentView
(
UpdateView
):
model
=
Assignment
form_class
=
AssignmentForm
template_name
=
'assignments/assignment-edit.html'
def
index
(
request
):
output
=
f
"Widget's Assignments Page<br><br>"
count
=
Assignment
.
objects
.
all
()
.
count
()
for
i
in
range
(
1
,
count
+
1
):
assignments
=
Assignment
.
objects
.
get
(
id
=
i
)
output
+=
f
"""Assignment Name: {assignments.name}<br>
Description: {assignments.description}<br>
Perfect Score: {assignments.perfect_score}<br>
Passing Score: {assignments.passing_score}<br>
Course/Section: {assignments.course.code} {assignments.course.title}-{assignments.course.section}<br>
<br>"""
return
HttpResponse
(
output
)
assignments
=
Assignment
.
objects
.
all
()
context
=
{
'assignments'
:
assignments
}
return
render
(
request
,
'assignments/assignments.html'
,
context
)
widget_robo_mommy/Dashboard/views.py
View file @
0e90f3f3
...
...
@@ -25,7 +25,7 @@ def Dashboard_list_view(request):
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="/
A
ssignments">Assignment</a><br>'
html_string_3
+=
'<a href="/
a
ssignments">Assignment</a><br>'
html_string_3
+=
'<a href="/widget_Calendar/">Calendar</a><br>'
html_string_final
=
html_string_1
+
html_string_2
+
html_string_3
+
'</html>'
...
...
widget_robo_mommy/assignments/templates/assignments/assignment-add.html
0 → 100644
View file @
0e90f3f3
{% extends 'base.html' %}
{% block content %}
<title>
Add Assignment
</title>
<h1>
Add a new assignment:
</h1>
<form
action=
""
method=
POST
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save New Assignment"
>
</form>
{% endblock content %}
widget_robo_mommy/assignments/templates/assignments/assignment-details.html
0 → 100644
View file @
0e90f3f3
{% extends 'base.html' %}
{% block content %}
<title>
{{ assignment.name }}
</title>
<h1>
{{ assignment.name }}
</h1>
<p>
{{ assignment.course.code }} {{ assignment.course.title }}-{{ assignment.course.section }}
<br><br>
Description: {{ assignment.description }}
<br>
Perfect Score: {{ assignment.perfect_score }}
<br>
Passing Score: {{ assignment.passing_score }}
<br>
</p>
<li>
<a
href=
"{{ assignment.get_update_url }}"
>
Edit Assignment
</a>
</li>
{% endblock %}
widget_robo_mommy/assignments/templates/assignments/assignment-edit.html
0 → 100644
View file @
0e90f3f3
{% extends 'base.html' %}
{% block content %}
<title>
Edit Assignment
</title>
<h1>
Edit Assignment.
</h1>
<form
action=
""
method=
POST
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save Changes to Assignment"
>
</form>
{% endblock content %}
widget_robo_mommy/assignments/templates/assignments/assignments.html
0 → 100644
View file @
0e90f3f3
{% extends 'base.html' %}
{% block content %}
<title>
Widget's Assignments
</title>
<h1>
Welcome to Widget's Assignments!
</h1>
{% for assignment in assignments %}
<a
href=
"{{ assignment.pk }}/details/"
>
{{ assignment.name }}
</a><br>
{% endfor %}
<br>
<a
href=
"add/"
><button
value=
"click here"
>
New Assignment
</button></a><br><br>
<a
href=
"/Dashboard/"
>
Dashboard
</a><br>
<a
href=
"/announcements/"
>
Announcements
</a><br>
<a
href=
"/forum/"
>
Forum
</a><br>
<a
href=
"/widget_Calendar/"
>
Calendar
</a><br>
{% endblock content %}
widget_robo_mommy/forum/templates/forum/forum.html
View file @
0e90f3f3
...
...
@@ -16,6 +16,6 @@
<a
href=
"/Dashboard/"
>
Dashboard
</a><br>
<a
href=
"/announcements/"
>
Announcements
</a><br>
<a
href=
"/
A
ssignments/"
>
Assignments
</a><br>
<a
href=
"/
a
ssignments/"
>
Assignments
</a><br>
<a
href=
"/widget_Calendar/"
>
Calendar
</a><br>
{% endblock content %}
\ No newline at end of file
widget_robo_mommy/widget_Calendar/migrations/0003_alter_event_course.py
View file @
0e90f3f3
...
...
@@ -7,7 +7,7 @@ import django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
A
ssignments'
,
'0002_alter_assignment_course'
),
(
'
a
ssignments'
,
'0002_alter_assignment_course'
),
(
'widget_Calendar'
,
'0002_event_location_delete_indexcard_event_location'
),
]
...
...
@@ -15,6 +15,6 @@ class Migration(migrations.Migration):
migrations
.
AlterField
(
model_name
=
'event'
,
name
=
'course'
,
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'event'
,
to
=
'
A
ssignments.course'
),
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'event'
,
to
=
'
a
ssignments.course'
),
),
]
widget_robo_mommy/widget_Calendar/models.py
View file @
0e90f3f3
from
django.db
import
models
from
A
ssignments.models
import
Course
from
a
ssignments.models
import
Course
MODE_TYPES
=
(
...
...
widget_robo_mommy/widget_robo_mommy/settings.py
View file @
0e90f3f3
...
...
@@ -38,7 +38,7 @@ ALLOWED_HOSTS = []
INSTALLED_APPS
=
[
'announcements'
,
'
A
ssignments'
,
'
a
ssignments'
,
'forum.apps.ForumConfig'
,
'Dashboard.apps.DashboardConfig'
,
'django.contrib.admin'
,
...
...
widget_robo_mommy/widget_robo_mommy/urls.py
View file @
0e90f3f3
...
...
@@ -22,7 +22,7 @@ urlpatterns = [
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
=
"A
ssignments"
)),
path
(
'
assignments/'
,
include
(
'assignments.urls'
,
namespace
=
"a
ssignments"
)),
path
(
''
,
include
((
'forum.urls'
,
'forum'
),
namespace
=
'forum'
)),
# 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