mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Fix filtering action logs by type
This commit is contained in:
parent
d70632c624
commit
43bfed664d
3 changed files with 6 additions and 6 deletions
|
@ -85,7 +85,7 @@ def classes_for_action_type(action_type):
|
||||||
if action_type == "whitelists":
|
if action_type == "whitelists":
|
||||||
return [users.models.Whitelist.__name__]
|
return [users.models.Whitelist.__name__]
|
||||||
|
|
||||||
if action_type == "ban":
|
if action_type == "bans":
|
||||||
return [users.models.Ban.__name__]
|
return [users.models.Ban.__name__]
|
||||||
|
|
||||||
if action_type == "topology":
|
if action_type == "topology":
|
||||||
|
|
|
@ -60,9 +60,9 @@ class ActionsSearch:
|
||||||
if end:
|
if end:
|
||||||
query &= Q(date_created__leq=end)
|
query &= Q(date_created__leq=end)
|
||||||
|
|
||||||
action_classes = self.classes_for_action_types(action_types)
|
action_models = self.models_for_action_types(action_types)
|
||||||
if action_classes:
|
if action_models:
|
||||||
query &= Q(object__classname=action_classes)
|
query &= Q(version__content_type__model__in=action_models)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Revision.objects.all()
|
Revision.objects.all()
|
||||||
|
@ -71,7 +71,7 @@ class ActionsSearch:
|
||||||
.prefetch_related("version_set__object")
|
.prefetch_related("version_set__object")
|
||||||
)
|
)
|
||||||
|
|
||||||
def classes_for_action_types(self, action_types):
|
def models_for_action_types(self, action_types):
|
||||||
if action_types is None:
|
if action_types is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
{% for reversion in revision.version_set.all %}
|
{% for reversion in revision.version_set.all %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ reversion.object|truncatechars:20 }}</td>
|
<td>{{ reversion.object|truncatechars:20 }}</td>
|
||||||
<td>{{ reversion.object|classname }}</td>
|
<td>{{ reversion.content_type.model|truncatechars:20 }}</td>
|
||||||
<td>{{ revision.user }}</td>
|
<td>{{ revision.user }}</td>
|
||||||
<td>{{ revision.date_created }}</td>
|
<td>{{ revision.date_created }}</td>
|
||||||
<td>{{ revision.comment }}</td>
|
<td>{{ revision.comment }}</td>
|
||||||
|
|
Loading…
Reference in a new issue