On Saturday 15 April 2017 17:31:50 Anonymous Coder wrote:

> I need to filter lists of items to be displayed upon user selection in
> my list view.
> For instance if user selects 12 it should show only 12 products per
> page and so on.

For this specific issue:
https://docs.djangoproject.com/en/1.11/topics/pagination/

And quite easy to do with django.views.generic.ListView.

> My Django view has vairble items like below:
> 
> items=Items.objects.all()
> Now I need to get products as per user selection how would i do that?
> 
> <form>
> <span>Show:</span>
> <select class="orderby number" name="page_size">

Add onchange="this.form.submit()".
And tie page_size to the Paginator (paginate_by attribute on ListView) through 
urls.py.

If you need more dynamic filtering (sort order / color filter etc), you 
may want to look at one of these:

https://djangopackages.org/grids/g/filters/
-- 
Melvyn Sopacua

-- 
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+unsubscr...@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/4852443.rUL9aSSnB0%40devstation.
For more options, visit https://groups.google.com/d/optout.

Reply via email to