Improve upload form usability: clearer date and tag fields
This commit is contained in:
parent
d5996e00ea
commit
f1f7cd91d4
7 changed files with 24 additions and 6 deletions
|
|
@ -9,6 +9,7 @@ from crispy_forms.layout import Div, Layout, Submit
|
|||
from django import forms
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_select2.forms import ModelSelect2MultipleWidget
|
||||
|
||||
from .models import Gallery, Tag
|
||||
|
||||
|
|
@ -82,11 +83,13 @@ class UploadForm(forms.Form):
|
|||
label=_("New gallery event start date"),
|
||||
initial=datetime.date.today,
|
||||
required=False,
|
||||
widget=forms.DateInput(attrs={"type":"date"})
|
||||
)
|
||||
new_gallery_date_end = forms.DateField(
|
||||
label=_("New gallery event end date"),
|
||||
initial=datetime.date.today,
|
||||
required=False,
|
||||
widget=forms.DateInput(attrs={"type":"date"})
|
||||
)
|
||||
new_gallery_description = forms.CharField(
|
||||
widget=forms.Textarea(attrs={"rows": 4}),
|
||||
|
|
@ -97,9 +100,14 @@ class UploadForm(forms.Form):
|
|||
Tag.objects.all(),
|
||||
label=_("New gallery tags"),
|
||||
required=False,
|
||||
help_text=_(
|
||||
'Hold down "Control", or "Command" on a Mac, to select more than one.'
|
||||
),
|
||||
widget=ModelSelect2MultipleWidget(
|
||||
model=Tag,
|
||||
search_fields=['name__icontains'],
|
||||
attrs = {
|
||||
'data-minimum-input-length': 0,
|
||||
'data-placeholder': 'Select tags',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue