1

I have a need to enter product ids in the url of my admin page but Django does not allow me to.

This is my function that does work.

    def get_queryset(self, request):
      qs = super(LaptopStockAdmin, self).get_queryset(request)

      pid = request.GET.get('pid')
      if pid is not None:
        ids = [int(id) for id in pid.split(',')]
        return qs.filter(id__in=ids)
      else:
        return qs

It gets the objects related to the ids but then Django refreshes the page and ads ?e=1 after the URL.

This is a security related problem and I cannot find a suitable solution.

I have tried these methods but they don't work for my specific case.

Is there a way to not create a list filter and where the results are shown in the admin page?

Rob Michiels
  • 134
  • 1
  • 5

0 Answers0