https://djangosnippets.org/snippets/2619/
According to above snippet if we access {{ counter_var }} in template after initializing it should return previous count. But in my case it does not return anything. template code <div class="question_number pull-left">Q{% counter %}. </div>...<script>var no_of_questions={{ counter_var }}</script> Template tag is registered and it prints correctly Q<count>. except counter_var. Even I tried by setting context variable counter_var from view as {'counter_var':0,...} then it returns '0'. How to get it working so that it returns previous counter? e.g. Q1. Q2. then counter_var should return 2 instead of nothing. Django: 1.8.6 Python: 2.7 *Note: I asked same question on stackoverflow but no help till now.* -- 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/bd6b7357-70af-4a34-b50b-8d5711319e5c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.