I have no idea

parent 02082545
...@@ -50,13 +50,16 @@ class Assignment(models.Model): ...@@ -50,13 +50,16 @@ class Assignment(models.Model):
passing_score = max_points * .6 passing_score = max_points * .6
def __str__(self): def __str__(self):
return self.name return '{} <br> Description: {} <br> Perfect Score: {} <br> Passing Score: {}'.format(self.name, self.description, self.max_points, self.passing_score)
def get_absolute_url(self): def get_absolute_url(self):
return reverse('assignment', args=[(self.name)]) return reverse('assignment', args=[(self.full_assignment)])
class Course(models.Model): class Course(models.Model):
course_code = models.CharField(max_length = 10) course_code = models.CharField(max_length = 10)
course_title = models.CharField(max_length = 100) course_title = models.CharField(max_length = 100)
section = models.CharField(max_length = 3) section = models.CharField(max_length = 3)
assignment = models.ForeignKey(Assignment, ) assignment = models.ForeignKey(Assignment, on_delete = models.CASCADE)
def __str__(self):
return '{} {} {}'.format(self.course_code, self.course_title, self.section)
from django.http import HttpResponse from django.http import HttpResponse
from .models import WidgetUser, Forum, Announcement, Assignments, from .models import WidgetUser, Forum, Announcement, Assignment, Course
def homepage(request): def homepage(request):
return HttpResponse('Welcome to Widget!') return HttpResponse('Welcome to Widget!')
def assignments(request): def assignments(request):
return HttpResponse('This is the Assignments page!') assignments = Assignment.objects.all()
output = "Assignments: <br>" + "<br>".join([str(details) for details in assignments])
return HttpResponse(output, content_type = "text/plain")
def announcements(request): def announcements(request):
return HttpResponse('This is the Announcement Board!') return HttpResponse('This is the Announcement Board!')
......
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