Console : tri par nom

This commit is contained in:
Olivier DOSSMANN 2017-08-17 21:09:55 +02:00
parent 9560cdd574
commit 235cb0e453
4 changed files with 14 additions and 26 deletions

1
TODO
View File

@ -5,7 +5,6 @@
* Tests sur Game * Tests sur Game
* Ajouter des attributs à Game * Ajouter des attributs à Game
* Données initiales des consoles connues * Données initiales des consoles connues
* Trier le champ console de Game par ordre alphabétique : Meta => order sur Console
# Idée # Idée

View File

@ -3,6 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -19,5 +20,14 @@ class Migration(migrations.Migration):
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=254)), ('name', models.CharField(max_length=254)),
], ],
options={'ordering': ('name',)},
),
migrations.CreateModel(
name='Game',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=254)),
('console', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='games.Console')),
],
), ),
] ]

View File

@ -1,24 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-08-16 20:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('games', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Game',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=254)),
('console', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='games.Console')),
],
),
]

View File

@ -10,6 +10,9 @@ class Console(models.Model):
def __str__(self): def __str__(self):
return '%s' % self.name return '%s' % self.name
class Meta:
ordering = ('name',)
class Game(models.Model): class Game(models.Model):
""" """