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