File tree Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Expand file tree Collapse file tree 4 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 22{% load append_to_get %}
33{% load i18n %}
44
5- 
6- {% if page_obj|length >  1 %}
5+ {% if paginator.num_pages >  1 %}
76    {% captureas full_anchor %}
87        {% if anchor %}
98            #{{ anchor }}
Original file line number Diff line number Diff line change 8181        {% endfor %}
8282    </ div > 
8383
84-     {% include "misc/pagination.part. html" with position=' bottom'  %}
84+     {% include "misc/paginator. html" with position=" bottom"  %}
8585{% endblock %}
8686
8787
Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ def get_context_data(self, **kwargs):
263263        context ['topic' ] =  self .object 
264264        context ['last_post_pk' ] =  self .object .last_message .pk 
265265        context ['form' ] =  PrivatePostForm (self .object )
266-         context ['posts' ] =  self .build_list ( )
266+         context ['posts' ] =  self .build_list_with_previous_item ( context [ 'object_list' ] )
267267        if  never_privateread (self .object ):
268268            mark_read (self .object )
269269        return  context 
Original file line number Diff line number Diff line change @@ -40,19 +40,20 @@ def get_context_data(self, **kwargs):
4040        context .update (kwargs )
4141        return  super (MultipleObjectMixin , self ).get_context_data (** context )
4242
43-     def  build_list (self ):
43+     def  build_list_with_previous_item (self ,  queryset ):
4444        """ 
4545        For some list paginated, we would like to display the last item of the previous page. 
4646        This function returns the list paginated with this previous item. 
4747        """ 
48+         original_list  =  queryset .all ()
4849        list  =  []
4950        # If necessary, add the last item in the previous page. 
5051        if  self .page .number  !=  1 :
5152            last_page  =  self .paginator .page (self .page .number  -  1 ).object_list 
5253            last_item  =  (last_page )[len (last_page ) -  1 ]
5354            list .append (last_item )
5455        # Adds all items of the list paginated. 
55-         for  item  in  self . object_list :
56+         for  item  in  original_list :
5657            list .append (item )
5758        return  list 
5859
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments