Alphabetically sort editors and teachers. Close #13

This commit is contained in:
Gabriel Augendre 2018-06-02 16:39:10 +02:00
parent d28ce54bc8
commit 4395ee5428
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,21 @@
# Generated by Django 2.0.5 on 2018-06-02 14:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('manuels', '0020_auto_20180602_1630'),
]
operations = [
migrations.AlterModelOptions(
name='editor',
options={'ordering': ['name'], 'verbose_name': 'éditeur', 'verbose_name_plural': 'éditeurs'},
),
migrations.AlterModelOptions(
name='teacher',
options={'ordering': ['first_name'], 'verbose_name': 'coordonnateur', 'verbose_name_plural': 'coordonnateurs'},
),
]

View file

@ -14,6 +14,7 @@ from django.urls import reverse
class BaseModel(models.Model): class BaseModel(models.Model):
class Meta: class Meta:
abstract = True abstract = True
created_at = models.DateTimeField('créé le', auto_now_add=True) created_at = models.DateTimeField('créé le', auto_now_add=True)
updated_at = models.DateTimeField('mis à jour le', auto_now=True) updated_at = models.DateTimeField('mis à jour le', auto_now=True)
@ -31,6 +32,8 @@ class Teacher(BaseModel):
class Meta: class Meta:
verbose_name = 'coordonnateur' verbose_name = 'coordonnateur'
verbose_name_plural = 'coordonnateurs' verbose_name_plural = 'coordonnateurs'
ordering = ['first_name']
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
first_name = models.CharField('prénom', max_length=100) first_name = models.CharField('prénom', max_length=100)
last_name = models.CharField('nom', max_length=100) last_name = models.CharField('nom', max_length=100)
@ -80,6 +83,7 @@ class Level(BaseModel):
class Meta: class Meta:
verbose_name = 'classe' verbose_name = 'classe'
verbose_name_plural = 'classes' verbose_name_plural = 'classes'
name = models.CharField('nom', max_length=50) name = models.CharField('nom', max_length=50)
def __str__(self): def __str__(self):
@ -90,6 +94,8 @@ class Editor(BaseModel):
class Meta: class Meta:
verbose_name = 'éditeur' verbose_name = 'éditeur'
verbose_name_plural = 'éditeurs' verbose_name_plural = 'éditeurs'
ordering = ['name']
name = models.CharField('nom', max_length=100) name = models.CharField('nom', max_length=100)
def __str__(self): def __str__(self):