Correction : empêcher d'ajouter 2 fois la même collection (figurine/consoles)

This commit is contained in:
Olivier DOSSMANN 2018-01-16 19:07:39 +01:00
parent 63bed8818e
commit 083d10fc6e
3 changed files with 57 additions and 1 deletions

View File

@ -5,7 +5,8 @@ from django.utils.translation import ugettext as _
class Collection(models.Model): class Collection(models.Model):
name = models.CharField(max_length=255, verbose_name=_('name')) name = models.CharField(
max_length=255, verbose_name=_('name'), unique=True)
shortname = models.CharField(max_length=30, verbose_name=_('shortname')) shortname = models.CharField(max_length=30, verbose_name=_('shortname'))
def __str__(self): def __str__(self):

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-16 17:56
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('figurines', '0002_auto_20180115_1730'),
]
operations = [
migrations.AlterModelOptions(
name='figurine',
options={'ordering': ('name', )}, ),
migrations.AlterField(
model_name='set',
name='name',
field=models.CharField(
help_text='Usual name of figurines set.',
max_length=255,
unique=True,
verbose_name='name'), ),
migrations.AlterField(
model_name='set',
name='shortname',
field=models.CharField(max_length=30, verbose_name='shortname'), ),
]

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-16 17:56
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('games', '0010_auto_20180115_1730'),
]
operations = [
migrations.AlterField(
model_name='platform',
name='name',
field=models.CharField(
help_text='Most used platform name.',
max_length=255,
unique=True,
verbose_name='name'), ),
]