From f15ff94dceaa86a7856324b092ad811847036f82 Mon Sep 17 00:00:00 2001 From: Alexandre Muller Date: Tue, 29 Aug 2023 15:31:42 +0200 Subject: [PATCH] Fix nulls=last persistency in template Fix self.null_ordering reassignment to avoid modification in template. --- webstack_django_sorting/templatetags/sorting_tags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webstack_django_sorting/templatetags/sorting_tags.py b/webstack_django_sorting/templatetags/sorting_tags.py index 5dc4a9f..6c5f77e 100644 --- a/webstack_django_sorting/templatetags/sorting_tags.py +++ b/webstack_django_sorting/templatetags/sorting_tags.py @@ -112,12 +112,12 @@ def render(self, context): queryset = self.queryset_var.resolve(context) order_by = common.get_order_by_from_request(context["request"]) - self.null_ordering = common.get_null_ordering( + null_ordering = common.get_null_ordering( context["request"], self.null_ordering ) try: - context[key] = common.sort_queryset(queryset, order_by, self.null_ordering) + context[key] = common.sort_queryset(queryset, order_by, null_ordering) except ValueError as e: raise template.TemplateSyntaxError from e except AttributeError: