Commit 244fd7c7 authored by RJC's avatar RJC

event app course field foreign keyed to assignment app course

parent 2b804b8b
from django.db import models from django.db import models
from Assignments.models import Course
MODE_TYPES = ( MODE_TYPES = (
...@@ -24,7 +25,7 @@ class Event(models.Model): ...@@ -24,7 +25,7 @@ class Event(models.Model):
Location, Location,
on_delete=models.CASCADE on_delete=models.CASCADE
) )
course = models.CharField(max_length=20) course = models.ForeignKey(Course, related_name='event', on_delete=models.CASCADE, null=True)
def __str__(self): def __str__(self):
return '{} on {}'.format(self.activity, self.target_datetime) return '{} on {}'.format(self.activity, self.target_datetime)
...@@ -17,7 +17,7 @@ def index(request): ...@@ -17,7 +17,7 @@ def index(request):
eventItem.target_datetime, eventItem.target_datetime,
eventItem.activity, eventItem.activity,
eventItem.estimated_hours, eventItem.estimated_hours,
eventItem.course, eventItem.course.code,
eventItem.location.mode, eventItem.location.mode,
eventItem.location.venue, eventItem.location.venue,
) )
......
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