mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Unique together remplace unique
This commit is contained in:
parent
6507bc5bda
commit
21c1dd1320
2 changed files with 23 additions and 1 deletions
20
cotisations/migrations/0027_auto_20171029_1156.py
Normal file
20
cotisations/migrations/0027_auto_20171029_1156.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-10-29 10:56
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cotisations', '0026_auto_20171028_0126'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='article',
|
||||
name='name',
|
||||
field=models.CharField(max_length=255),
|
||||
),
|
||||
]
|
|
@ -246,7 +246,7 @@ class Article(models.Model):
|
|||
('All', 'All'),
|
||||
)
|
||||
|
||||
name = models.CharField(max_length=255, unique=True)
|
||||
name = models.CharField(max_length=255)
|
||||
prix = models.DecimalField(max_digits=5, decimal_places=2)
|
||||
duration = models.PositiveIntegerField(
|
||||
help_text="Durée exprimée en mois entiers",
|
||||
|
@ -266,6 +266,8 @@ class Article(models.Model):
|
|||
max_length=255
|
||||
)
|
||||
|
||||
unique_together = ('name', 'type_user')
|
||||
|
||||
def clean(self):
|
||||
if self.name.lower() == "solde":
|
||||
raise ValidationError("Solde est un nom d'article invalide")
|
||||
|
|
Loading…
Reference in a new issue