Commit 21c1dd13 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Unique together remplace unique

parent 6507bc5b
# -*- 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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment