mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 03:12:26 +02:00
add placeholders on grouped orders create form
This commit is contained in:
parent
72d7ea82de
commit
97c507ae15
2 changed files with 23 additions and 2 deletions
|
@ -1,15 +1,34 @@
|
|||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
|
||||
from django.db import IntegrityError
|
||||
from django.forms import CharField, ModelForm
|
||||
|
||||
from la_chariotte.order.models import GroupedOrder, Item
|
||||
|
||||
from django.forms import ( # isort:skip
|
||||
CharField,
|
||||
DateInput,
|
||||
DateTimeInput,
|
||||
ModelForm,
|
||||
Textarea,
|
||||
TextInput,
|
||||
)
|
||||
|
||||
|
||||
class GroupedOrderForm(ModelForm):
|
||||
class Meta:
|
||||
model = GroupedOrder
|
||||
fields = ["name", "deadline", "delivery_date", "place", "description"]
|
||||
widgets = {
|
||||
"name": TextInput(attrs={"placeholder": "ex : Des oranges pour Noël"}),
|
||||
"deadline": DateTimeInput(attrs={"placeholder": "JJ/MM/AAAA HH:MM"}),
|
||||
"delivery_date": DateInput(attrs={"placeholder": "JJ/MM/AAAA"}),
|
||||
"place": TextInput(attrs={"placeholder": "(facultatif)"}),
|
||||
"description": Textarea(
|
||||
attrs={
|
||||
"placeholder": "Plus d'infos sur la commande groupée ? (facultatif)"
|
||||
}
|
||||
),
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.user = kwargs.pop("user")
|
||||
|
|
|
@ -14,7 +14,9 @@ class GroupedOrder(models.Model):
|
|||
)
|
||||
delivery_date = models.DateField("Date de livraison")
|
||||
deadline = models.DateTimeField("Date limite de commande")
|
||||
place = models.CharField(max_length=100, null=True, blank=True, verbose_name="Lieu de livraison")
|
||||
place = models.CharField(
|
||||
max_length=100, null=True, blank=True, verbose_name="Lieu de livraison"
|
||||
)
|
||||
description = models.TextField("Description", null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
|
|
Loading…
Reference in a new issue