Add default ordering for Recette and Ingredient

This commit is contained in:
Claude Paroz 2018-06-01 20:35:54 +02:00
parent 491b7a33cf
commit 27947907d5
2 changed files with 8 additions and 0 deletions

View file

@ -23,6 +23,7 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nom', models.CharField(max_length=200, verbose_name='Nom')),
],
options={'ordering': ('nom',)},
),
migrations.CreateModel(
name='Recette',
@ -35,6 +36,7 @@ class Migration(migrations.Migration):
('source', models.CharField(blank=True, max_length=200, verbose_name='Source')),
('ingredients', models.ManyToManyField(blank=True, through='recette.Composition', to='recette.Ingredient')),
],
options={'ordering': ('nom',)},
),
migrations.CreateModel(
name='Unite',

View file

@ -9,6 +9,9 @@ from .fields import ChoiceArrayField
class Ingredient(models.Model):
nom = models.CharField("Nom", max_length=200)
class Meta:
ordering = ('nom',)
def __str__(self):
return self.nom
@ -39,6 +42,9 @@ class Recette(models.Model):
source = models.CharField("Source", max_length=200, blank=True)
ingredients = models.ManyToManyField(Ingredient, through='Composition', blank=True)
class Meta:
ordering = ('nom',)
def __str__(self):
return self.nom