8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-23 03:43:12 +00:00

Fix et empèche des valeurs négatives aux articles

This commit is contained in:
Gabriel Detraz 2017-07-18 23:31:04 +02:00
parent 856a666a72
commit ff416f39b8
2 changed files with 28 additions and 2 deletions

View file

@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-18 21:29
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cotisations', '0016_auto_20160715_0110'),
]
operations = [
migrations.AlterField(
model_name='article',
name='duration',
field=models.IntegerField(blank=True, help_text='Durée exprimée en mois entiers', null=True, validators=[django.core.validators.MinValueValidator(0)]),
),
migrations.AlterField(
model_name='article',
name='name',
field=models.CharField(max_length=255, unique=True),
),
]

View file

@ -104,10 +104,10 @@ def vente_post_delete(sender, **kwargs):
class Article(models.Model): class Article(models.Model):
PRETTY_NAME = "Articles en vente" PRETTY_NAME = "Articles en vente"
name = models.CharField(max_length=255) name = models.CharField(max_length=255, unique=True)
prix = models.DecimalField(max_digits=5, decimal_places=2) prix = models.DecimalField(max_digits=5, decimal_places=2)
iscotisation = models.BooleanField() iscotisation = models.BooleanField()
duration = models.IntegerField(help_text="Durée exprimée en mois entiers", blank=True, null=True) duration = models.IntegerField(validators=[MinValueValidator(0)], help_text="Durée exprimée en mois entiers", blank=True, null=True)
def clean(self): def clean(self):