WIP: Affiche un warning si trop d'alcool consommé #727

Draft
lstephan wants to merge 4 commits from Aufinal/alcoolémie into master
3 changed files with 44 additions and 0 deletions
Showing only changes of commit e533966f55 - Show all commits

View file

@ -288,6 +288,8 @@ class ArticleForm(forms.ModelForm):
"hidden",
"price",
"stock",
"abv",
"volume",
"category",
"box_type",
"box_capacity",
@ -301,6 +303,8 @@ class ArticleRestrictForm(ArticleForm):
"is_sold",
"hidden",
"price",
"abv",
"volume",
"category",
"box_type",
"box_capacity",

View file

@ -0,0 +1,33 @@
# Generated by Django 2.2.12 on 2020-05-15 15:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("kfet", "0071_promo_2020"),
]
operations = [
migrations.AddField(
model_name="article",
name="abv",
field=models.DecimalField(
decimal_places=1,
default=0,
max_digits=6,
verbose_name="Degré d'alcool (en %)",
),
),
migrations.AddField(
model_name="article",
name="volume",
field=models.DecimalField(
decimal_places=1,
default=0,
max_digits=6,
verbose_name="Volume d'une unité (en cL)",
),
),
]

View file

@ -520,6 +520,13 @@ class Article(models.Model):
"capacité du contenant", blank=True, null=True, default=None
)
abv = models.DecimalField(
_("Degré d'alcool (en %)"), max_digits=6, default=0, decimal_places=1
)
volume = models.DecimalField(
_("Volume d'une unité (en cL)"), max_digits=6, default=0, decimal_places=1
)
def __str__(self):
return "%s - %s" % (self.category.name, self.name)