diff --git a/logs/forms.py b/logs/forms.py index ffae8e52..ae281e98 100644 --- a/logs/forms.py +++ b/logs/forms.py @@ -85,7 +85,7 @@ def classes_for_action_type(action_type): if action_type == "whitelists": return [users.models.Whitelist.__name__] - if action_type == "ban": + if action_type == "bans": return [users.models.Ban.__name__] if action_type == "topology": diff --git a/logs/models.py b/logs/models.py index 6528ea23..ce2b3602 100644 --- a/logs/models.py +++ b/logs/models.py @@ -60,9 +60,9 @@ class ActionsSearch: if end: query &= Q(date_created__leq=end) - action_classes = self.classes_for_action_types(action_types) - if action_classes: - query &= Q(object__classname=action_classes) + action_models = self.models_for_action_types(action_types) + if action_models: + query &= Q(version__content_type__model__in=action_models) return ( Revision.objects.all() @@ -71,7 +71,7 @@ class ActionsSearch: .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: return None diff --git a/logs/templates/logs/aff_stats_logs.html b/logs/templates/logs/aff_stats_logs.html index adccc95f..ab12a02f 100644 --- a/logs/templates/logs/aff_stats_logs.html +++ b/logs/templates/logs/aff_stats_logs.html @@ -47,7 +47,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for reversion in revision.version_set.all %}