Commit 78670e99 authored by Robert's avatar Robert

Handle int param in case of str input, refs #605

parent 47a5bed0
......@@ -4,5 +4,15 @@ import translitcodec # noqa: F401, used indirectly via "translit/"
import django.utils.text
def intify(string, default=0):
if string is None:
return default
return int(string)
except ValueError:
return default
def slugify(value):
return django.utils.text.slugify(codecs.encode(value, 'translit/long'))
......@@ -16,7 +16,7 @@ class Detail(core.views.PermissionMixin, django.views.generic.ListView):
def get_queryset(self):
self.tag = self.get_tag()
self.groups = groups.Group.objects.filter(tags__tag=self.tag)
self.tagged_only = int(self.request.GET.get('tagged', 0))
self.tagged_only = core.text.intify(self.request.GET.get('tagged'), 0)
tagged_query = Q(content__taggeds__tag=self.tag)
qs = super().get_queryset().ordered_user_content(self.request.user)
if self.tagged_only:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment