class Course(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='courses')
students = models.ManyToManyField(Student, related_name='students')
class CategoryByType(models.Model):
name = models.CharField(_('Название'), max_length=255)
def __str__(self):
return self.name
class CategoryBySkill(models.Model):
name = models.CharField(_('Название'), max_length=255)
def __str__(self):
return self.name
class Course(models.Model):
category_by_type = models.ForeignKey(CategoryByType, on_delete=models.CASCADE)
category_by_skill = models.ForeignKey(CategoryBySkill, on_delete=models.CASCADE)
name = models.CharField(_('Название'),max_length=255)
author = models.ForeignKey(Teacher, on_delete=models.CASCADE)
students = models.ManyToManyField(Student)
description = models.TextField(_('Описание'),)
image = models.ImageField(_('Постер'), upload_to='course/posters', blank=True, null=True)
create_date = models.DateField(_('Дата создания'),auto_now_add=True)
update_date = models.DateField(_('Дата обновления'),auto_now=True)
hourse = models.IntegerField(_('Кол-во часов'),)
active = models.BooleanField(default=False)