django 1.11: ensure compatibility with recent django-tables2 (#21489)

django-tables2 1.1 is not compatbible with django 1.11
In recent version of django-tables2 'row' is not available in
the context of TemplateColumn, so we use direclty 'record'
(instead of 'row.record').
This commit is contained in:
Emmanuel Cazenave 2018-08-01 15:51:58 +02:00 committed by Frédéric Péters
parent e696f983b2
commit db9b9028b1
3 changed files with 6 additions and 4 deletions

View File

@ -114,7 +114,7 @@ setup(name="authentic2",
'django-model-utils>=2.4',
'dnspython>=1.10',
'Django-Select2>5,<6',
'django-tables2>=1.0,<1.1',
'django-tables2>=1.0,<2.0',
'gadjo>=0.53',
'django-import-export>=0.2.7',
'djangorestframework>=3.3,<3.4',

View File

@ -113,9 +113,9 @@ class OuUserRolesTable(tables.Table):
kwargs={'pk': A('pk')},
accessor='name', verbose_name=_('label'))
via = tables.TemplateColumn(
'''{% for rel in row.record.via %}{{ rel.child }} {% if not forloop.last %}, {% endif %}{% endfor %}''',
'''{% for rel in record.via %}{{ rel.child }} {% if not forloop.last %}, {% endif %}{% endfor %}''',
verbose_name=_('Inherited from'), orderable=False)
member = tables.TemplateColumn('''{% load i18n %}<input class="role-member{% if not row.record.member and row.record.via %} indeterminate{% endif %}" name='role-{{ row.record.pk }}' type='checkbox' {% if row.record.member %}checked{% endif %} {% if not row.record.has_perm %}disabled title="{% trans "You are not authorized to manage this role" %}"{% endif %}/>''',
member = tables.TemplateColumn('''{% load i18n %}<input class="role-member{% if not record.member and record.via %} indeterminate{% endif %}" name='role-{{ record.pk }}' type='checkbox' {% if record.member %}checked{% endif %} {% if not record.has_perm %}disabled title="{% trans "You are not authorized to manage this role" %}"{% endif %}/>''',
verbose_name=_('Member'), order_by=('member', 'via', 'name'))
@ -132,7 +132,7 @@ class UserRolesTable(tables.Table):
accessor='name', verbose_name=_('label'))
ou = tables.Column()
via = tables.TemplateColumn(
'''{% if not row.record.member %}{% for rel in row.record.child_relation.all %}{{ rel.child }} {% if not forloop.last %}, {% endif %}{% endfor %}{% endif %}''',
'''{% if not record.member %}{% for rel in record.child_relation.all %}{{ rel.child }} {% if not forloop.last %}, {% endif %}{% endfor %}{% endif %}''',
verbose_name=_('Inherited from'), orderable=False)
class Meta:

View File

@ -27,7 +27,9 @@ usedevelop =
deps =
pip > 9
dj18: django>1.8,<1.9
dj18: django-tables2<1.1
dj111: django<2.0
dj111: django-tables<2.0
pg: psycopg2
coverage
pytest-cov