Finishing up assignments app

parent 54290254
# Generated by Django 4.0.3 on 2022-05-19 15:51
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('announcements', '0003_reaction_reaction_name'),
]
operations = [
migrations.AlterField(
model_name='reaction',
name='announcement',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reacts', to='announcements.announcement'),
),
]
# Generated by Django 4.0.3 on 2022-05-19 15:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assignments', '0003_assignment_course'),
]
operations = [
migrations.AddField(
model_name='assignment',
name='image',
field=models.ImageField(default=1, upload_to='images'),
preserve_default=False,
),
]
...@@ -24,6 +24,8 @@ class Assignment(models.Model): ...@@ -24,6 +24,8 @@ class Assignment(models.Model):
course = models.ForeignKey(Course, on_delete = models.CASCADE) course = models.ForeignKey(Course, on_delete = models.CASCADE)
image = models.ImageField(upload_to='images')
@property @property
def passing_score(self): def passing_score(self):
return self.max_points * 0.60 return self.max_points * 0.60
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% block content %} {% block content %}
<ul> <ul>
{% for c in course_list %} {% for c in course_list|dictsort:"course_code" %}
<li><p class="course_section">{{ c.course_code }} {{ c.course_title }} {{ c.section }}</p> <li><p class="course_section">{{ c.course_code }} {{ c.course_title }} {{ c.section }}</p>
<ul class="course_assignments"> <ul class="course_assignments">
{% for a in assignment_list %} {% for a in assignment_list %}
......
...@@ -11,4 +11,5 @@ ...@@ -11,4 +11,5 @@
<p class="desc">{{ object.description }}</p> <p class="desc">{{ object.description }}</p>
<p class="score">Perfect Score: {{ object.max_points }}</p> <p class="score">Perfect Score: {{ object.max_points }}</p>
<p class="score">Passing Score: {{ object.passing_score }}</p> <p class="score">Passing Score: {{ object.passing_score }}</p>
<img src= "{{ object.image }}">
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -4,7 +4,7 @@ from .views import AssignmentsPageView, AssignmentDetailView ...@@ -4,7 +4,7 @@ from .views import AssignmentsPageView, AssignmentDetailView
urlpatterns = [ urlpatterns = [
path('', AssignmentsPageView.as_view(), name='index'), path('', AssignmentsPageView.as_view(), name='index'),
path('<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-detail'), path('assignment/<int:pk>/details', AssignmentDetailView.as_view(), name='assignment-detail'),
] ]
app_name = "assignments" app_name = "assignments"
\ No newline at end of file
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment