Hi,

I am not really sure what you are trying to accomplish. What you are
writing doesn't make sense.

I think you should check how to write the paginate by properties. You can
find some information here:
https://docs.djangoproject.com/en/1.11/topics/pagination/
https://simpleisbetterthancomplex.com/tutorial/2016/08/03/how-to-paginate-with-django.html

How you are using the paginate by property doesn't seem to make sense or I
don't understand what you are trying to accomplish :-)

Best regards,

Andréas

2017-10-28 19:04 GMT+02:00 Naaim Iss <t.logv...@gmail.com>:

> Hello everyone.
> I hace a ListView-based class with attribute `paginate_by = 12`.
> There is in HTML-template a select element with seveeral options, for
> pagination of course. Options come to the page from context. Loks like this:
> `
> <select  onchange="location.href='?results_per_page='+value;">
> {% for item in per_page_options %}
>     <option value="{{ item }}"
>         {% if request.GET.results_per_page == item or paginate_by == item
> %}
>         selected="selected" {% endif %}
>         >{{ item }}
>     </option>
> {% endfor %}
> </select>
> `
>
> When i change value of select attribute `paginate_by` changes succesfully
> and on page another option is selected, according to new value of
> `paginate_by'
> But when i move to another page on this template the value 'selection'
> stops working and in "options" the first value becomes "selected".
> Even tried to check how this template reads the "context" from "view", by
> adding this code next on page
> `
> {% if request.GET.results_per_page == paginate_by %}
>     <h5>{{ paginate_by }} - {{ request.GET.results_per_page }}</h5>
> {% endif %}
> `
> And after changing the page I can see this new string. Like 3 - 3 or 9 -
> 9, etc.
>
> Looks like some bug. But never saw it before.
> Any ideas?
>
> Thanks anyway.
>
> --
> 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/bb7eeb52-8a29-474a-9607-3cc9f108b1dd%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/bb7eeb52-8a29-474a-9607-3cc9f108b1dd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAK4qSCdhao_-SNO3B5s51KxhAwrnvWk9ke-qWKBpDHBKpW9d%3DA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to