From 147ff29fb5a904ea228659656b114efb56b5703b Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 24 Apr 2020 22:40:21 +0000 Subject: [PATCH] Add username autocompletion in event filter view --- logs/forms.py | 4 ++-- logs/templates/logs/search_stats_logs.html | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/logs/forms.py b/logs/forms.py index ae281e98..30780d4a 100644 --- a/logs/forms.py +++ b/logs/forms.py @@ -97,9 +97,9 @@ def classes_for_action_type(action_type): class ActionsSearchForm(Form): """The form for a simple search""" - u = forms.CharField( + u = forms.ModelChoiceField( label=_("Performed by"), - max_length=100, + queryset=users.models.User.objects.all(), required=False, ) t = forms.MultipleChoiceField( diff --git a/logs/templates/logs/search_stats_logs.html b/logs/templates/logs/search_stats_logs.html index 5faa8066..5211d336 100644 --- a/logs/templates/logs/search_stats_logs.html +++ b/logs/templates/logs/search_stats_logs.html @@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% endcomment %} {% load bootstrap3 %} +{% load massive_bootstrap_form %} {% load i18n %} {% block title %}{% trans "Search events" %}{% endblock %} @@ -31,10 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,

{% trans "Search events" %}

- {% bootstrap_field actions_form.u %} - {% include 'buttons/multiple_checkbox_alt.html' with field=actions_form.t %} - {% bootstrap_field actions_form.s %} - {% bootstrap_field actions_form.e %} + {% massive_bootstrap_form actions_form 'u' %} {% trans "Search" as tr_search %} {% bootstrap_button tr_search button_type="submit" icon="search" %}