diff --git a/doc/source/front-end/template-tags.rst b/doc/source/front-end/template-tags.rst index 29ff34268e..e51fe356e5 100644 --- a/doc/source/front-end/template-tags.rst +++ b/doc/source/front-end/template-tags.rst @@ -86,23 +86,24 @@ Ce filtre formate une date au format ``DateTime`` destiné à être affiché sur Ce filtre effectue la même chose que ``format_date`` mais à destination des ``tooltip``. -``humane_time`` ---------------- +``date_from_timestamp`` +----------------------- -Formate une date au format *Nombre de seconde depuis Epoch* en un élément lisible. Ainsi : +Convertit une date au format *Nombre de seconde depuis Epoch* en un objet +accepté par les autres filtres de ce module. Ainsi : .. sourcecode:: html+django {% load date %} - {{ date_epoch|humane_time }} + {{ date_epoch|date_from_timestamp|format_date }} sera rendu : .. sourcecode:: text - jeudi 01 janvier 1970 à 00h00 + jeudi 01 janvier 1970 à 00h02 - …si le contenu de ``date_epoch`` était de ``42``. + …si le contenu de ``date_epoch`` était de ``122``. ``from_elasticsearch_date`` --------------------------- diff --git a/templates/tutorialv2/view/history.html b/templates/tutorialv2/view/history.html index c7556ea4ef..0d4ac02829 100644 --- a/templates/tutorialv2/view/history.html +++ b/templates/tutorialv2/view/history.html @@ -111,7 +111,7 @@

{% endif %} - {{ commit.authored_date|humane_time }} + {{ commit.authored_date|date_from_timestamp|format_date }} @@ -161,7 +161,7 @@

{% trans "mettre à jour" %} {% endif %} {% endcaptureas %} - {% blocktrans with action=action date_version=commit.authored_date|humane_time content_title=content.title %} + {% blocktrans with action=action date_version=commit.authored_date|date_from_timestamp|format_date content_title=content.title %} Êtes-vous certain de vouloir {{ action }} la bêta pour le contenu "{{ content_title }}" dans sa version de {{ date_version }} ? {% endblocktrans %} diff --git a/zds/forum/forms.py b/zds/forum/forms.py index 166eb54b16..17f3108468 100644 --- a/zds/forum/forms.py +++ b/zds/forum/forms.py @@ -27,9 +27,7 @@ class TopicForm(forms.Form, FieldValidatorMixin): label=_("Tag(s) séparés par une virgule (exemple: python,django,web)"), max_length=64, required=False, - widget=forms.TextInput( - attrs={"data-autocomplete": '{ "type": "multiple", "fieldname": "title", "url": "/api/tags/?search=%s" }'} - ), + widget=forms.TextInput(), ) text = forms.CharField( @@ -44,6 +42,15 @@ class TopicForm(forms.Form, FieldValidatorMixin): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + + self.fields["tags"].widget.attrs.update( + { + "data-autocomplete": '{ "type": "multiple", "fieldname": "title", "url": "' + + reverse("api:utils:tags-list") + + '?search=%s" }' + } + ) + self.helper = FormHelper() self.helper.form_class = "content-wrapper" self.helper.form_method = "post" @@ -53,11 +60,11 @@ def __init__(self, *args, **kwargs): Field("subtitle", autocomplete="off"), Field("tags"), HTML( - """