django - Selected number of transactions per page is not working -



django - Selected number of transactions per page is not working -

i'm creating selected options user can select number of transactions want show in each page. sample:

<select class="select compact" onchange="location = this.options[this.selectedindex].value;"> <option value="{% url transactions:transaction %}?page=1" {% if page == 1 %}selected{% endif %}> 1 transaction </option> <option value="{% url transactions:transaction %}?page=2" {% if page == 2 %}selected{% endif %}> 2 transactions </option> <option value="{% url transactions:transaction %}?page=3" {% if page == 3 %}selected{% endif %}> 3 transactions </option> </select>

views

page = 1 if request.get.get('page'): per_page = request.get.get('page') transactions = ba_transactions(request.user).unassigned() paginator = paginator(transactions, page) try: page = int(request.get.get('page', '1')) except valueerror: page = 1 try: transactions = paginator.page(page) except (emptypage, invalidpage): transactions = paginator.page(paginator.num_pages)

if select 1 output ok. if select 2, shows 1 transaction (the actual info in table). what's wrong codes?

django

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -