Since `parser.tokens` doesn't returns a whole tokens of a template, in this
case the last remaining autopaginate tag makes `multiple_paginations` false,
so page-suffix of the last paginate tag will be empty.
self.multiple_paginations = multiple_paginations
def render(self, context):
- if self.multiple_paginations or getattr(context, "paginator", None):
+ # Save multiple_paginations state in context
+ if self.multiple_paginations and 'multiple_paginations' not in context:
+ context['multiple_paginations'] = True
+
+ if context.get('multiple_paginations') or getattr(context, "paginator", None):
page_suffix = '_%s' % self.queryset_var
else:
page_suffix = ''