Add abv and volume to Article model

This commit is contained in:
Ludovic Stephan 2020-05-20 17:44:07 +02:00
parent 3ca8b45014
commit e533966f55
3 changed files with 44 additions and 0 deletions

View file

@ -288,6 +288,8 @@ class ArticleForm(forms.ModelForm):
"hidden", "hidden",
"price", "price",
"stock", "stock",
"abv",
"volume",
"category", "category",
"box_type", "box_type",
"box_capacity", "box_capacity",
@ -301,6 +303,8 @@ class ArticleRestrictForm(ArticleForm):
"is_sold", "is_sold",
"hidden", "hidden",
"price", "price",
"abv",
"volume",
"category", "category",
"box_type", "box_type",
"box_capacity", "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 "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): def __str__(self):
return "%s - %s" % (self.category.name, self.name) return "%s - %s" % (self.category.name, self.name)