Woo , finally did it !
For those coming after me , here is how I did :
Your struggle probably comes from the self.value() never being a list , right ? Well then, if you override the template filter.html to add a "multiple" to the <select>, then , in your redefinition of the queryset() function, do a self.value = request.GET.getlist("[Insert parameter_name from your filter]"), then you'll get the list you clicked back in the Django admin !
(The problem being that django uses request.GET.items() to retrieve the self.value(). Alas, as stated in this documentation, this method only gets the last item of the QueryDict object, unlike getlist() !
There is still one little problem to fix, being that , when loading the new page, the filter is being "resetted", containing only the last item of the QueryDict. I believe that's nothing that an handy JS /JQuery script can't handle though, so I may edit this comment adding the script when I manage to get it to work.
Cheers!
-- For those coming after me , here is how I did :
Your struggle probably comes from the self.value() never being a list , right ? Well then, if you override the template filter.html to add a "multiple" to the <select>, then , in your redefinition of the queryset() function, do a self.value = request.GET.getlist("[Insert parameter_name from your filter]"), then you'll get the list you clicked back in the Django admin !
(The problem being that django uses request.GET.items() to retrieve the self.value(). Alas, as stated in this documentation, this method only gets the last item of the QueryDict object, unlike getlist() !
There is still one little problem to fix, being that , when loading the new page, the filter is being "resetted", containing only the last item of the QueryDict. I believe that's nothing that an handy JS /JQuery script can't handle though, so I may edit this comment adding the script when I manage to get it to work.
Cheers!
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f1416a0e-8a86-4c8f-882e-f1cd2565d1f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment