Wednesday, November 24, 2021

def post in ListView

Hi everyone,

Is there anything dangerous about this?
class ItemList(ListView):
    model = Item
    def post(self, request, *args, **kwargs):
        self.request.GET = self.request.POST
        return super().get(request, *args, **kwargs)

I want to use this to accept filtering parameters from a form in a list view template. This ListView also has a get_queryset which returns a filtered query based on the parameters

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aa7a1392-e388-4727-b412-bd1329daa6c4n%40googlegroups.com.

No comments:

Post a Comment