diff --git a/src/agenda_culturel/forms.py b/src/agenda_culturel/forms.py index 260c4ee..1d1becb 100644 --- a/src/agenda_culturel/forms.py +++ b/src/agenda_culturel/forms.py @@ -1,6 +1,6 @@ from django.forms import ModelForm, ValidationError, TextInput, Form, URLField, MultipleHiddenInput, Textarea, CharField from datetime import date - +from django_better_admin_arrayfield.forms.widgets import DynamicArrayWidget from .models import Event, BatchImportation from django.utils.translation import gettext_lazy as _ @@ -9,6 +9,12 @@ class EventSubmissionForm(Form): url = URLField(max_length=512) +class DynamicArrayWidgetURLs(DynamicArrayWidget): + template_name = "agenda_culturel/widgets/widget-urls.html" + +class DynamicArrayWidgetTags(DynamicArrayWidget): + template_name = "agenda_culturel/widgets/widget-tags.html" + class EventForm(ModelForm): class Meta: @@ -21,6 +27,8 @@ class EventForm(ModelForm): 'end_time': TextInput(attrs={'type': 'time'}), 'uuids': MultipleHiddenInput(), 'import_sources': MultipleHiddenInput(), + 'reference_urls': DynamicArrayWidgetURLs(), + 'tags': DynamicArrayWidgetTags(), } @@ -77,3 +85,5 @@ class BatchImportationForm(ModelForm): # Always return a value to use as the new cleaned data, even if # this method didn't change it. return cleaned_data + + diff --git a/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html b/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html index 981c132..49a151a 100644 --- a/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/edit-buttons-inc.html @@ -6,12 +6,14 @@ publier {% picto_from_name "eye" %} {% endif %} -{% if event.status != "draft" %} -brouillon {% picto_from_name "eye-off" %} +{% if event.status == "published" %} +dépublier {% picto_from_name "eye-off" %} +{% elif event.status == "trash" %} +restaurer {% picto_from_name "eye-off" %} {% endif %} {% if event.status != "trash" %} -corbeille {% picto_from_name "trash-2" %} +supprimer {% picto_from_name "trash-2" %} {% endif %} {% if event.status == "trash" %} diff --git a/src/agenda_culturel/templates/agenda_culturel/widgets/widget-tags.html b/src/agenda_culturel/templates/agenda_culturel/widgets/widget-tags.html new file mode 100644 index 0000000..ddfa555 --- /dev/null +++ b/src/agenda_culturel/templates/agenda_culturel/widgets/widget-tags.html @@ -0,0 +1,22 @@ +{% load static %} +{% load i18n %} + +{% spaceless %} + +{% endspaceless %} \ No newline at end of file diff --git a/src/agenda_culturel/templates/agenda_culturel/widgets/widget-urls.html b/src/agenda_culturel/templates/agenda_culturel/widgets/widget-urls.html new file mode 100644 index 0000000..706148d --- /dev/null +++ b/src/agenda_culturel/templates/agenda_culturel/widgets/widget-urls.html @@ -0,0 +1,22 @@ +{% load static %} +{% load i18n %} + +{% spaceless %} + +{% endspaceless %} \ No newline at end of file