Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import uuid
- from django.db import models
- from django.utils.text import gettext_lazy as _
- from .models import Course, Instructor
- class CourseTimeline(models.Model):
- id = models.UUIDField(
- _('id'),
- default=uuid.uuid4,
- primary_key=True,
- editable=False,
- unique=True
- )
- instructor = models.ForeignKey(Instructor, verbose_name=_('instructor'), related_name='courses', on_delete=models.CASCADE)
- course = models.ForeignKey(Course, verbose_name=_('course'), related_name='instructors', on_delete=models.CASCADE)
- start = models.DateField(_('start date of the course'))
- end = models.DateField(_('end date of the course'))
- class Meta:
- db_table = 'courses_timeline'
- def __str__(self):
- return '%s %s (%s-%s)'%(self.instructor, self.course, self.start, self.end)
Add Comment
Please, Sign In to add comment