From 73030aedb38fe05a3c76f5bd45b36fbab42ffdc3 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Tue, 30 Jan 2018 19:32:49 +0300 Subject: [PATCH] LIL-22. Add index for title & short_description fields Course model --- .../migrations/0019_auto_20180130_1630.py | 23 +++++++++++++++++++ apps/course/models.py | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 apps/course/migrations/0019_auto_20180130_1630.py diff --git a/apps/course/migrations/0019_auto_20180130_1630.py b/apps/course/migrations/0019_auto_20180130_1630.py new file mode 100644 index 00000000..d9e99a77 --- /dev/null +++ b/apps/course/migrations/0019_auto_20180130_1630.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0.1 on 2018-01-30 16:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('course', '0018_auto_20180130_1248'), + ] + + operations = [ + migrations.AlterField( + model_name='course', + name='short_description', + field=models.TextField(db_index=True, verbose_name='Краткое описание курса'), + ), + migrations.AlterField( + model_name='course', + name='title', + field=models.CharField(db_index=True, max_length=100, verbose_name='Название курса'), + ), + ] diff --git a/apps/course/models.py b/apps/course/models.py index 42eafe7b..12db9652 100644 --- a/apps/course/models.py +++ b/apps/course/models.py @@ -24,8 +24,8 @@ class Course(models.Model): (2, 'Archived'), ) author = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True) - title = models.CharField('Название курса', max_length=100) - short_description = models.TextField('Краткое описание курса') + 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)