Commit 2dfd98ab authored by Ciella's avatar Ciella

Bugfix: string displays

parent 60c980e6
......@@ -7,9 +7,12 @@ class Course(models.Model):
title = models.CharField(max_length=255)
section = models.CharField(max_length=3)
def __str__(self):
def format_course(self):
return '{} {} - {}'.format(self.code, self.title, self.section)
def __str__(self):
return '{}-{}'.format(self.code, self.section)
class Assignment(models.Model):
name = models.CharField(max_length=255)
......@@ -22,8 +25,11 @@ class Assignment(models.Model):
self.passing_score = int((self.perfect_score)*(0.60))
super(Assignment, self).save(*args, **kwargs)
def __str__(self):
def format_assignment(self):
return '{}'.format(self.name)
def __str__(self):
return '{} {}: {}'.format(self.course.code, self.course.section, self.name)
def get_absolute_url(self):
return reverse('assignments:assignment-details', kwargs={'pk': self.pk})
\ No newline at end of file
......@@ -20,11 +20,11 @@
</div>
<div class="col-9 text-center">
<div class="row p-5 text-center" style="background-color:#e3e4e6">
<h1 class="display-3" style="font-size:50px; color:#052c65">{{ object }}</h1>
<h1 class="display-3" style="font-size:50px; color:#052c65">{{ object.name }}</h1>
</div>
<br>
<div class="row p-2" style="background-color:#e3e4e6">
<h5 class="display-3" style="font-size:25px">{{ object.course }}</h5>
<h5 class="display-3" style="font-size:25px">{{ object.course.format_course }}</h5>
</div>
<br>
<div class="row">
......
......@@ -24,7 +24,7 @@
<br>
{% for task in tasks %}
<a href="{{ task.get_absolute_url }}" class="link-dark; display-3" style="font-size:18px; color:#052c65">
{{ task }}</a>
{{ task.format_assignment }}</a>
<br>
{% endfor %}
<br><br>
......
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