Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_jenicaesports
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
Christianneil Emmanuel Ocampo
midterm_jenicaesports
Commits
653eb15b
Commit
653eb15b
authored
May 10, 2023
by
Ciella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix for models, URLs, and views
parent
385eee3d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
models.py
widget_jenicaesports/assignments/models.py
+6
-2
urls.py
widget_jenicaesports/assignments/urls.py
+4
-4
views.py
widget_jenicaesports/assignments/views.py
+1
-1
No files found.
widget_jenicaesports/assignments/models.py
View file @
653eb15b
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
# Create your models here.
# Create your models here.
class
Course
(
models
.
Model
):
class
Course
(
models
.
Model
):
...
@@ -7,7 +8,7 @@ class Course(models.Model):
...
@@ -7,7 +8,7 @@ class Course(models.Model):
section
=
models
.
CharField
(
max_length
=
3
)
section
=
models
.
CharField
(
max_length
=
3
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} {}
'
.
format
(
self
.
cod
e
,
self
.
section
)
return
'{} {}
- {}'
.
format
(
self
.
code
,
self
.
titl
e
,
self
.
section
)
class
Assignment
(
models
.
Model
):
class
Assignment
(
models
.
Model
):
...
@@ -22,4 +23,7 @@ class Assignment(models.Model):
...
@@ -22,4 +23,7 @@ class Assignment(models.Model):
super
(
Assignment
,
self
)
.
save
(
*
args
,
**
kwargs
)
super
(
Assignment
,
self
)
.
save
(
*
args
,
**
kwargs
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} {}: {}'
.
format
(
self
.
course
.
code
,
self
.
course
.
section
,
self
.
name
)
return
'{}'
.
format
(
self
.
name
)
\ No newline at end of file
def
get_absolute_url
(
self
):
return
reverse
(
'assignments:assignment-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
\ No newline at end of file
widget_jenicaesports/assignments/urls.py
View file @
653eb15b
...
@@ -3,10 +3,10 @@ from django.urls import path
...
@@ -3,10 +3,10 @@ from django.urls import path
from
.views
import
assignments_view
,
AssignmentDetailView
,
AssignmentCreateView
,
AssignmentUpdateView
from
.views
import
assignments_view
,
AssignmentDetailView
,
AssignmentCreateView
,
AssignmentUpdateView
urlpatterns
=
[
urlpatterns
=
[
path
(
'
assignments/'
,
assignments_view
,
name
=
'assignments_view
'
),
path
(
'
'
,
assignments_view
,
name
=
'assignments
'
),
path
(
'
assignments/
<int:pk>/details/'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
),
path
(
'<int:pk>/details/'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
),
path
(
'a
ssignments/a
dd/'
,
AssignmentCreateView
.
as_view
(),
name
=
'assignment-add'
),
path
(
'add/'
,
AssignmentCreateView
.
as_view
(),
name
=
'assignment-add'
),
path
(
'
assignments/
<int:pk>/edit/'
,
AssignmentUpdateView
.
as_view
(),
name
=
'assignment-edit'
),
path
(
'<int:pk>/edit/'
,
AssignmentUpdateView
.
as_view
(),
name
=
'assignment-edit'
),
]
]
app_name
=
'assignments'
app_name
=
'assignments'
\ No newline at end of file
widget_jenicaesports/assignments/views.py
View file @
653eb15b
...
@@ -8,7 +8,7 @@ from .models import Assignment
...
@@ -8,7 +8,7 @@ from .models import Assignment
def
assignments_view
(
request
):
def
assignments_view
(
request
):
tasks
=
Assignment
.
objects
.
all
()
tasks
=
Assignment
.
objects
.
all
()
context
=
{
'tasks'
:
tasks
}
context
=
{
'tasks'
:
tasks
}
return
render
(
request
,
'assignments/assignments.html'
)
return
render
(
request
,
'assignments/assignments.html'
,
context
)
class
AssignmentDetailView
(
DetailView
):
class
AssignmentDetailView
(
DetailView
):
...
...
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