Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_nicsbabes
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
Nics De Vega
midterm_nicsbabes
Commits
ab553878
Commit
ab553878
authored
May 11, 2023
by
rachbit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created assignment-details, updated models and views
parent
ed4e7984
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
1 deletion
+38
-1
models.py
widget_nicsbabes/assignments/models.py
+4
-0
assignment-details.html
...assignments/templates/assignments/assignment-details.html
+22
-0
urls.py
widget_nicsbabes/assignments/urls.py
+3
-1
views.py
widget_nicsbabes/assignments/views.py
+9
-0
No files found.
widget_nicsbabes/assignments/models.py
View file @
ab553878
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
class
Course
(
models
.
Model
):
class
Course
(
models
.
Model
):
...
@@ -21,3 +22,6 @@ class Assignment(models.Model):
...
@@ -21,3 +22,6 @@ class Assignment(models.Model):
def
passing_score
(
self
):
def
passing_score
(
self
):
return
(
self
.
perfect_score
*
60
)
//
100
return
(
self
.
perfect_score
*
60
)
//
100
def
get_absolute_url
(
self
):
return
reverse
(
'assignments:assignment-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
widget_nicsbabes/assignments/templates/assignments/assignment-details.html
0 → 100644
View file @
ab553878
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ object.name }} {% endblock %}
{% block content %}
<div
style=
"text-transform:uppercase;"
>
<h1>
{{ object.name }}
</h1>
</div>
<h2>
{{ object.course.code }} {{ object.course.title }}-{{ object.course.section }}
</h2>
<div>
Description: {{ object.description }}
<br>
Perfect Score: {{ object.perfect_score }}
<br>
Passing Score: {{ object.passing_score }}
<br>
</div>
<br>
<a
href=
"../#/"
>
<button
type=
"button"
><p>
Edit Assignment
</p></button>
</a>
{% endblock %}
widget_nicsbabes/assignments/urls.py
View file @
ab553878
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
*
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
index
,
name
=
'index'
),
path
(
'<int:pk>/details'
,
AssignmentsDetailView
.
as_view
(),
name
=
'assignment-details'
),
]
]
# This might be needed, depending on your Django version
# This might be needed, depending on your Django version
app_name
=
"assignments"
app_name
=
"assignments"
widget_nicsbabes/assignments/views.py
View file @
ab553878
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views.generic
import
ListView
,
DetailView
,
CreateView
,
UpdateView
from
.models
import
Assignment
,
Course
from
.models
import
Assignment
,
Course
def
index
(
request
):
def
index
(
request
):
assignments
=
Assignment
.
objects
.
all
()
assignments
=
Assignment
.
objects
.
all
()
args
=
{
'assignments'
:
assignments
}
args
=
{
'assignments'
:
assignments
}
return
render
(
request
,
'assignments/assignments.html'
,
args
)
return
render
(
request
,
'assignments/assignments.html'
,
args
)
class
AssignmentsView
(
ListView
):
model
=
Assignment
template_name
=
'assignments/assignments.html'
class
AssignmentsDetailView
(
DetailView
):
model
=
Assignment
template_name
=
'assignments/assignment-details.html'
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