From abd70657d76edd3dedddf08df97927525ea8cb53 Mon Sep 17 00:00:00 2001 From: Fedor Borshev Date: Thu, 29 Dec 2016 12:13:29 +0300 Subject: [PATCH] TimelineEntry Meta duplication fix --- timeline/migrations/0012_ordering.py | 18 ++++++++++++++++++ timeline/models.py | 14 ++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 timeline/migrations/0012_ordering.py diff --git a/timeline/migrations/0012_ordering.py b/timeline/migrations/0012_ordering.py new file mode 100644 index 00000000..01d159b3 --- /dev/null +++ b/timeline/migrations/0012_ordering.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('timeline', '0011_unique_lesson_type'), + ] + + operations = [ + migrations.AlterModelOptions( + name='entry', + options={'permissions': (('other_entries', "Can work with other's timeleine entries"),), 'verbose_name': 'Planned class', 'verbose_name_plural': 'Planned classes', 'ordering': ['start']}, + ), + ] diff --git a/timeline/models.py b/timeline/models.py index adf666f0..66c9ad95 100644 --- a/timeline/models.py +++ b/timeline/models.py @@ -197,6 +197,12 @@ class Entry(models.Model): class Meta: ordering = ['start'] + unique_together = ['teacher', 'lesson_type', 'start'] + verbose_name = 'Planned class' + verbose_name_plural = 'Planned classes' + permissions = ( + ('other_entries', "Can work with other's timeleine entries"), + ) @property def is_free(self): @@ -220,14 +226,6 @@ def get_step2_url(self): 'time': format(start_time, 'H:i') }) - class Meta: - unique_together = ('teacher', 'lesson_type', 'start') - verbose_name = 'Planned class' - verbose_name_plural = 'Planned classes' - permissions = ( - ('other_entries', "Can work with other's timeleine entries"), - ) - def __str__(self): """ Event title for the teacher