Sorry , I should have posted the template
well, the error is,  hmm, 
suppose you are at  page 1  , now you clicked next and you got to page 2 
and the `post` method is hit. It will get page number as 2. But for  
formset , the initial data will have to be compared with  page "1" s data 
not "2". In the current scenario ,the initial_data  was the page2's but the 
data that was posted was for page 1. So you see the problem? It took me 
quite long to understand this.

  
 


{% extends 'adminuser/portal.html' %} 
{% block main-content %}
{% load my_extra_filters %}
 {% if messages %}
{% for message in messages %}

<div class="alert alert-success" role="alert">{{ message }}</div>
{% endfor %}
 {% endif %}

<form method="post" >

  {% csrf_token %}
  {{ formset.management_form }}

  <table class="table">
    <thead>
      <tr>
        <th scope="col">Name</th>
        <th scope="col">Pan ID</th>
        <th scope="col">Print Report?</th>
      </tr>
    </thead>

    <tbody>
      {% for user_form in formset %}
        {% for user_data in object_list %}
          {% if forloop.counter0 == forloop.parentloop.counter0 %}
              <tr>
                <td>{{user_data.get_full_name.}}</td>
                <td>{{user_data.PAN_ID}}</td>
                {{user_form.PAN_ID}}
                
                <td>{{user_form.print_report_check}}</td>
              </tr>
      
          {% endif %}
        {% endfor %}
    
      {% endfor %}


    </tbody> 
  </table>
<div class="pagination">
    <span class="step-links">
        {% if page_obj.has_previous %}
            <button class="btn btn-dark"  formaction="?page=1">&laquo; first
</button>
            <button class="btn btn-dark" formaction="?page={{ page_obj.
previous_page_number }}">previous</button>
        {% endif %}

        <span class="current">
            Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
.
        </span>

        {% if page_obj.has_next %}
            <button class="btn btn-dark" formaction="?page={{ page_obj.
next_page_number }}">next</button>
            <button class="btn btn-dark" formaction="?page={{ page_obj.
paginator.num_pages }}">last &raquo;</button>
        {% endif %}
    </span>
</div>

  <button class="btn btn-dark">Print</button>

</form>

{% endblock main-content%}




On Friday, June 11, 2021 at 8:34:36 PM UTC+5:30 sutharl...@gmail.com wrote:

> possibly you are requesting with the same pan id again
>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a36ad778-fe78-4f26-b0d1-fb7563bd8081n%40googlegroups.com.

Reply via email to