Commit b622e5e9 authored by Baptiste Jonglez's avatar Baptiste Jonglez
Browse files

Ensure that billing period and commitment are positive

parent 50be8b2c
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('offers', '0004_auto_20150120_2309'),
]
operations = [
migrations.AlterField(
model_name='offer',
name='billing_period',
field=models.IntegerField(default=1, help_text='en mois', verbose_name='p\xe9riode de facturation', validators=[django.core.validators.MinValueValidator(1)]),
preserve_default=True,
),
migrations.AlterField(
model_name='offersubscription',
name='commitment',
field=models.IntegerField(default=0, help_text='en mois', verbose_name="p\xe9riode d'engagement", validators=[django.core.validators.MinValueValidator(0)]),
preserve_default=True,
),
]
......@@ -5,6 +5,7 @@ import datetime
from django.db import models
from django.db.models import Q
from django.core.validators import MinValueValidator
class Offer(models.Model):
......@@ -24,7 +25,8 @@ class Offer(models.Model):
help_text="Type de configuration à utiliser avec cette offre")
billing_period = models.IntegerField(blank=False, null=False, default=1,
verbose_name='période de facturation',
help_text='en mois')
help_text='en mois',
validators=[MinValueValidator(1)])
period_fees = models.DecimalField(max_digits=5, decimal_places=2,
blank=False, null=False,
verbose_name='montant par période de '
......@@ -95,7 +97,8 @@ class OfferSubscription(models.Model):
# TODO: move this to offers?
commitment = models.IntegerField(blank=False, null=False,
verbose_name="période d'engagement",
help_text = 'en mois',
help_text='en mois',
validators=[MinValueValidator(0)],
default=0)
member = models.ForeignKey('members.Member', verbose_name='membre')
offer = models.ForeignKey('Offer', verbose_name='offre')
......
Supports Markdown
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