forked from DGNum/gestioCOF
Use verbose names and form snippets for article_create
This commit is contained in:
parent
f32f83db75
commit
079666c0db
4 changed files with 31 additions and 12 deletions
|
@ -235,16 +235,20 @@ class CheckoutStatementUpdateForm(forms.ModelForm):
|
||||||
|
|
||||||
class ArticleForm(forms.ModelForm):
|
class ArticleForm(forms.ModelForm):
|
||||||
category_new = forms.CharField(
|
category_new = forms.CharField(
|
||||||
|
label="Créer une catégorie",
|
||||||
max_length=45,
|
max_length=45,
|
||||||
required = False)
|
required = False)
|
||||||
category = forms.ModelChoiceField(
|
category = forms.ModelChoiceField(
|
||||||
|
label="Catégorie",
|
||||||
queryset = ArticleCategory.objects.all(),
|
queryset = ArticleCategory.objects.all(),
|
||||||
required = False)
|
required = False)
|
||||||
|
|
||||||
suppliers = forms.ModelMultipleChoiceField(
|
suppliers = forms.ModelMultipleChoiceField(
|
||||||
|
label="Fournisseurs",
|
||||||
queryset = Supplier.objects.all(),
|
queryset = Supplier.objects.all(),
|
||||||
required = False)
|
required = False)
|
||||||
supplier_new = forms.CharField(
|
supplier_new = forms.CharField(
|
||||||
|
label="Créer un fournisseur",
|
||||||
max_length = 45,
|
max_length = 45,
|
||||||
required = False)
|
required = False)
|
||||||
|
|
||||||
|
|
|
@ -336,19 +336,21 @@ class ArticleCategory(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Article(models.Model):
|
class Article(models.Model):
|
||||||
name = models.CharField(max_length = 45)
|
name = models.CharField("nom", max_length = 45)
|
||||||
is_sold = models.BooleanField(default = True)
|
is_sold = models.BooleanField("en vente", default = True)
|
||||||
hidden = models.BooleanField(default=False,
|
hidden = models.BooleanField("caché",
|
||||||
|
default=False,
|
||||||
help_text="Si oui, ne sera pas affiché "
|
help_text="Si oui, ne sera pas affiché "
|
||||||
"au public ; par exemple "
|
"au public ; par exemple "
|
||||||
"sur la carte.")
|
"sur la carte.")
|
||||||
price = models.DecimalField(
|
price = models.DecimalField(
|
||||||
|
"prix",
|
||||||
max_digits = 6, decimal_places = 2,
|
max_digits = 6, decimal_places = 2,
|
||||||
default = 0)
|
default = 0)
|
||||||
stock = models.IntegerField(default = 0)
|
stock = models.IntegerField(default = 0)
|
||||||
category = models.ForeignKey(
|
category = models.ForeignKey(
|
||||||
ArticleCategory, on_delete = models.PROTECT,
|
ArticleCategory, on_delete = models.PROTECT,
|
||||||
related_name = "articles")
|
related_name = "articles", verbose_name='catégorie')
|
||||||
BOX_TYPE_CHOICES = (
|
BOX_TYPE_CHOICES = (
|
||||||
("caisse", "caisse"),
|
("caisse", "caisse"),
|
||||||
("carton", "carton"),
|
("carton", "carton"),
|
||||||
|
@ -356,10 +358,12 @@ class Article(models.Model):
|
||||||
("fût", "fût"),
|
("fût", "fût"),
|
||||||
)
|
)
|
||||||
box_type = models.CharField(
|
box_type = models.CharField(
|
||||||
|
"type de contenant",
|
||||||
choices = BOX_TYPE_CHOICES,
|
choices = BOX_TYPE_CHOICES,
|
||||||
max_length = choices_length(BOX_TYPE_CHOICES),
|
max_length = choices_length(BOX_TYPE_CHOICES),
|
||||||
blank = True, null = True, default = None)
|
blank = True, null = True, default = None)
|
||||||
box_capacity = models.PositiveSmallIntegerField(
|
box_capacity = models.PositiveSmallIntegerField(
|
||||||
|
"capacité du contenant",
|
||||||
blank = True, null = True, default = None)
|
blank = True, null = True, default = None)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -1,17 +1,27 @@
|
||||||
{% extends 'kfet/base.html' %}
|
{% extends 'kfet/base.html' %}
|
||||||
|
{% load widget_tweaks %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
|
||||||
{% block title %}Nouvel article{% endblock %}
|
{% block title %}Nouvel article{% endblock %}
|
||||||
{% block content-header-title %}Création d'un article{% endblock %}
|
{% block content-header-title %}Création d'un article{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<form submit="" method="post">
|
{% include "kfet/base_messages.html" %}
|
||||||
|
|
||||||
|
<div class="row form-only">
|
||||||
|
<div class="col-sm-12 col-md-8 col-md-offset-2">
|
||||||
|
<div class="content-form">
|
||||||
|
<form submit="" method="post" class="form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
{% include 'kfet/form_snippet.html' with form=form %}
|
||||||
{% if not perms.kfet.add_article %}
|
{% if not perms.kfet.add_article %}
|
||||||
<input type="password" name="KFETPASSWORD">
|
{% include 'kfet/form_authentication_snippet.html' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<input type="submit" value="Enregistrer">
|
{% include 'kfet/form_submit_snippet.html' with value="Enregistrer" %}
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>
|
<label for="{{ field.id_for_label }}" class="col-sm-2 control-label">{{ field.label }}</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
{{ field|add_class:'form-control' }}
|
{{ field|add_class:'form-control' }}
|
||||||
|
<span class="help-block">{{field.help_text}}</span>
|
||||||
<span class="help-block">{{ field.errors }}</span>
|
<span class="help-block">{{ field.errors }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue