-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
forloop.counter not render in Django1.10 for TemplateColumn #488
forloop.counter not render in Django1.10 for TemplateColumn #488
Comments
so with the exact same version of django-tables2, different django versions show this behaviour? |
Exactly, different django versions show this behaviour. |
can you maybe supply a simple test case? |
I will prepare unit test today evening. |
For current master I can't reproduce this error. |
I think it makes sense to add a context variable containing a counter without counting on the template context leaking through... What do you think? If you have time, feel free to open a PR. |
As of version class CountryTable(tables.Table):
counter = tables.TemplateColumn('{{ row_counter }}', verbose_name='#') 1.14.2 is released. |
Now that |
You can use the add template filter: https://docs.djangoproject.com/en/2.0/ref/templates/builtins/#add |
class CountryTable(tables.Table):
counter = tables.TemplateColumn('{{ row_counter|add:1 }}', verbose_name='#') |
django-tables2==1.0.4
for Django 1.9.13 it works fine.
for Django 1.10 forloop not exist in table.context and not rendered correctly
Have you any idea?
I spent on this problem 8 hours trying solve it.
The text was updated successfully, but these errors were encountered: