Update Course model

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent 2d5b221349
commit 0a0f03b95c
  1. 19
      apps/course/migrations/0022_auto_20180208_0647.py
  2. 23
      apps/course/models.py

@ -0,0 +1,19 @@
# Generated by Django 2.0.2 on 2018-02-08 06:47
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('course', '0021_auto_20180206_0632'),
]
operations = [
migrations.AlterField(
model_name='course',
name='cover',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='course_covers', to='content.ImageObject', verbose_name='Обложка курса'),
),
]

@ -7,6 +7,8 @@ from polymorphic_tree.models import PolymorphicMPTTModel, PolymorphicTreeForeign
from .manager import CategoryQuerySet
from apps.content.models import ImageObject
User = get_user_model()
@ -30,10 +32,20 @@ class Course(models.Model):
title = models.CharField('Название курса', max_length=100, db_index=True)
short_description = models.TextField('Краткое описание курса', db_index=True)
from_author = models.TextField('От автора', default='', null=True, blank=True)
cover = models.ImageField('Фон курса', upload_to='courses')
price = models.DecimalField('Цена курса', help_text='Если цены нету, то курс бесплатный', max_digits=10, decimal_places=2, null=True, blank=True)
cover = models.ForeignKey(
ImageObject, related_name='course_covers',
verbose_name='Обложка курса', on_delete=models.CASCADE,
null=True, blank=True,
)
price = models.DecimalField(
'Цена курса', help_text='Если цены нету, то курс бесплатный',
max_digits=10, decimal_places=2, null=True, blank=True
)
is_infinite = models.BooleanField(default=False)
deferred_start_at = models.DateTimeField('Отложенный запуск курса', help_text='Заполнить если курс отложенный', null=True, blank=True)
deferred_start_at = models.DateTimeField(
'Отложенный запуск курса', help_text='Заполнить если курс отложенный',
null=True, blank=True
)
category = models.ForeignKey('Category', on_delete=models.PROTECT)
duration = models.IntegerField('Продолжительность курса', default=0)
is_featured = models.BooleanField(default=False)
@ -127,7 +139,10 @@ class Material(models.Model):
class Comment(PolymorphicMPTTModel):
content = models.TextField('Текст комментария', default='')
author = models.ForeignKey(User, on_delete=models.CASCADE)
parent = PolymorphicTreeForeignKey('self', null=True, blank=True, related_name='children', db_index=True, on_delete=models.PROTECT)
parent = PolymorphicTreeForeignKey(
'self', null=True, blank=True, related_name='children',
db_index=True, on_delete=models.PROTECT
)
created_at = models.DateTimeField(auto_now_add=True)
update_at = models.DateTimeField(auto_now=True)

Loading…
Cancel
Save