Add redirect link in assignment models after adding new assignment

parent 2ffc327a
from django.db import models from django.db import models
# Create your models here. # Create your models here.
class Course(models.Model): class Course(models.Model):
...@@ -8,7 +7,7 @@ class Course(models.Model): ...@@ -8,7 +7,7 @@ class Course(models.Model):
section = models.CharField(max_length=3) section = models.CharField(max_length=3)
def __str__(self): def __str__(self):
return self.course_code return "%s | %s - %s" % (self.course_code, self.course_title, self.section)
class Assignment(models.Model): class Assignment(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
...@@ -25,3 +24,6 @@ class Assignment(models.Model): ...@@ -25,3 +24,6 @@ class Assignment(models.Model):
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
self.passing_score = int(self.max_points*0.6) self.passing_score = int(self.max_points*0.6)
return super().save(*args, **kwargs) return super().save(*args, **kwargs)
def get_absolute_url(self):
return u'%d/details' % self.pk
\ No newline at end of file
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