Commit cf2f23e6 authored by Star Neptune R. Sy's avatar Star Neptune R. Sy

Fixed label error in the dropdowns of edit and add

parent 1e5878cf
...@@ -17,9 +17,9 @@ class AssignmentAdmin(admin.ModelAdmin): ...@@ -17,9 +17,9 @@ class AssignmentAdmin(admin.ModelAdmin):
class CourseAdmin(admin.ModelAdmin): class CourseAdmin(admin.ModelAdmin):
model = Course model = Course
list_display = ('course_code', 'course_title',) list_display = ('course_code', 'course_title','section',)
search_fields = ('course_code', 'course_title',) search_fields = ('course_code', 'course_title','section',)
list_filter = ('course_code', 'course_title',) list_filter = ('course_code', 'course_title','section',)
admin.site.register(Course, CourseAdmin) admin.site.register(Course, CourseAdmin)
......
# Generated by Django 3.2 on 2023-05-12 06:43
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('assignments', '0007_auto_20230512_1428'),
]
operations = [
migrations.RemoveField(
model_name='assignment',
name='courseDropDown',
),
]
...@@ -7,6 +7,9 @@ class Course(models.Model): ...@@ -7,6 +7,9 @@ class Course(models.Model):
section = models.CharField(default="",max_length=16,) section = models.CharField(default="",max_length=16,)
def __str__(self): def __str__(self):
return '{} {}'.format(self.course_code, self.section,)
def anotherFormat(self):
return '{} {}'.format(self.course_code, self.course_title,) return '{} {}'.format(self.course_code, self.course_title,)
...@@ -20,18 +23,15 @@ class Assignment(models.Model): ...@@ -20,18 +23,15 @@ class Assignment(models.Model):
on_delete=models.CASCADE, on_delete=models.CASCADE,
related_name='subject' related_name='subject'
) )
courseDropDown = models.CharField(unique=True, default="", max_length=100, blank=True)
def __str__(self): def __str__(self):
return '{} {}-'.format(self.assignment_name, self.section,) return '{} {}-'.format(self.assignment_name, self.course.section,)
def get_absolute_url(self): def get_absolute_url(self):
return '{}'.format(self.pk) return '{}'.format(self.pk)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
self.courseDropDown = '{} - {}'.format(self.course.course_code, self.section) self.passing_score = self.perfect_score*0.6
super().save(*args, **kwargs) # Call the "real" save() method. super(Assignment, self).save(*args, **kwargs)
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{% block heading %} <h1 class="pageTitle"> {{object.assignment_name}} </h1> {% endblock %} {% block heading %} <h1 class="pageTitle"> {{object.assignment_name}} </h1> {% endblock %}
{% block content %} {% block content %}
<h2> {{object.course}} - {{object.section}} </h2> <h2> {{object.course.anotherFormat}} - {{object.course.section}} </h2>
<p> <b>Description:</b> {{object.description}} <br> <p> <b>Description:</b> {{object.description}} <br>
<b>Perfect Score:</b> {{object.perfect_score}} <br> <b>Perfect Score:</b> {{object.perfect_score}} <br>
<b>Passing Score:</b> {{object.passing_score}} <br> <b>Passing Score:</b> {{object.passing_score}} <br>
......
...@@ -20,7 +20,7 @@ class AssignmentsDetailView(DetailView): ...@@ -20,7 +20,7 @@ class AssignmentsDetailView(DetailView):
class AssignmentsUpdateView(UpdateView): class AssignmentsUpdateView(UpdateView):
model = Assignment model = Assignment
fields = ["assignment_name","description","courseDropDown","perfect_score" ] fields = ["assignment_name","description","course","perfect_score" ]
template_name = "assignments/assignment-edit.html" template_name = "assignments/assignment-edit.html"
success_url = "../details" success_url = "../details"
...@@ -28,7 +28,7 @@ class AssignmentsUpdateView(UpdateView): ...@@ -28,7 +28,7 @@ class AssignmentsUpdateView(UpdateView):
class AssignmentsCreateView(CreateView): class AssignmentsCreateView(CreateView):
model = Assignment model = Assignment
fields = ["assignment_name","description","courseDropDown","perfect_score" ] fields = ["assignment_name","description","course","perfect_score" ]
template_name = "assignments/assignment-add.html" template_name = "assignments/assignment-add.html"
def get_success_url(self): def get_success_url(self):
......
# Generated by Django 3.2 on 2023-05-12 06:43
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0007_alter_forumpost_pub_datetime'),
]
operations = [
migrations.AlterField(
model_name='forumpost',
name='pub_datetime',
field=models.DateTimeField(default=datetime.datetime(2023, 5, 12, 14, 43, 53, 323691), editable=False),
),
]
# Generated by Django 3.2 on 2023-05-12 06:46
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0008_alter_forumpost_pub_datetime'),
]
operations = [
migrations.AlterField(
model_name='forumpost',
name='pub_datetime',
field=models.DateTimeField(default=datetime.datetime(2023, 5, 12, 14, 46, 44, 130987), editable=False),
),
]
# Generated by Django 3.2 on 2023-05-12 06:43
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('widget_calendar', '0013_alter_event_target_datetime'),
]
operations = [
migrations.AlterField(
model_name='event',
name='target_datetime',
field=models.DateTimeField(default=datetime.datetime(2023, 5, 12, 14, 43, 53, 325690)),
),
]
# Generated by Django 3.2 on 2023-05-12 06:46
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('widget_calendar', '0014_alter_event_target_datetime'),
]
operations = [
migrations.AlterField(
model_name='event',
name='target_datetime',
field=models.DateTimeField(default=datetime.datetime(2023, 5, 12, 14, 46, 44, 132978)),
),
]
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