mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Fix actions filtering
This commit is contained in:
parent
fc21a1da3e
commit
f196bc8046
3 changed files with 8 additions and 7 deletions
|
@ -40,16 +40,18 @@ def get_classes(module):
|
|||
|
||||
for name, obj in inspect.getmembers(module):
|
||||
if inspect.isclass(obj):
|
||||
classes.append((obj, name))
|
||||
classes.append(name)
|
||||
|
||||
return classes
|
||||
|
||||
|
||||
# Get the list of all imported classes
|
||||
modules = [machines.models, preferences.models, tickets.models, topologie.models, users.models]
|
||||
classes = sum([get_classes(m) for m in modules])
|
||||
classes = sum([get_classes(m) for m in modules], [])
|
||||
|
||||
CHOICES_ACTION_TYPE = classes
|
||||
CHOICES_ACTION_TYPE = [
|
||||
(str(i), classes[i]) for i in range(len(classes))
|
||||
]
|
||||
|
||||
CHOICES_TYPE = (
|
||||
("ip", _("IPv4")),
|
||||
|
@ -63,7 +65,6 @@ class ActionsSearchForm(Form):
|
|||
label=_("Performed by"),
|
||||
max_length=100,
|
||||
required=False,
|
||||
queryset=users.models.User.objects.all()
|
||||
)
|
||||
t = forms.MultipleChoiceField(
|
||||
label=_("Action type"),
|
||||
|
@ -76,7 +77,7 @@ class ActionsSearchForm(Form):
|
|||
e = forms.DateField(required=False, label=_("End date"))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MachineHistorySearchForm, self).__init__(*args, **kwargs)
|
||||
super(ActionsSearchForm, self).__init__(*args, **kwargs)
|
||||
self.fields["s"].help_text = get_input_formats_help_text(
|
||||
self.fields["s"].input_formats
|
||||
)
|
||||
|
|
|
@ -60,7 +60,7 @@ class ActionsSearch:
|
|||
query &= Q(date_created__leq=end)
|
||||
|
||||
if actions_type:
|
||||
query &= Q(version_set__object__in=actions_type)
|
||||
query &= Q(version__content_type__in=actions_type)
|
||||
|
||||
return (
|
||||
Revision.objects.all()
|
||||
|
|
|
@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<h3>{% trans "Search events" %}</h3>
|
||||
|
||||
{% bootstrap_field actions_form.u %}
|
||||
{% bootstrap_field actions_form.t %}
|
||||
{% include 'buttons/multiple_checkbox_alt.html' with field=actions_form.t %}
|
||||
{% bootstrap_field actions_form.s %}
|
||||
{% bootstrap_field actions_form.e %}
|
||||
{% trans "Search" as tr_search %}
|
||||
|
|
Loading…
Reference in a new issue