mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Fixed table form rendering for django-tables2>=1.2.1
This commit is contained in:
parent
edb8904474
commit
04fd197c9b
@ -4,7 +4,7 @@
|
|||||||
<form method="post" class="form form-horizontal">
|
<form method="post" class="form form-horizontal">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
|
<input type="hidden" name="redirect_url" value="{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" />
|
||||||
<input type="hidden" name="pk_all" value="{% for row in table.rows %}{{ row.record.pk|default:'' }}{% if not forloop.last %},{% endif %}{% endfor %}" />
|
<input type="hidden" name="pk_all" value="{% for obj in table.data.queryset %}{{ obj.pk|default:'' }}{% if not forloop.last %},{% endif %}{% endfor %}" />
|
||||||
{% if table.paginator.num_pages > 1 %}
|
{% if table.paginator.num_pages > 1 %}
|
||||||
<div id="select_all_box" class="hidden alert alert-info">
|
<div id="select_all_box" class="hidden alert alert-info">
|
||||||
<div class="checkbox-inline">
|
<div class="checkbox-inline">
|
||||||
|
@ -17,6 +17,10 @@ class BaseTable(tables.Table):
|
|||||||
'class': 'table table-hover',
|
'class': 'table table-hover',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def model(self):
|
||||||
|
return self._meta.model
|
||||||
|
|
||||||
|
|
||||||
class ToggleColumn(tables.CheckBoxColumn):
|
class ToggleColumn(tables.CheckBoxColumn):
|
||||||
|
|
||||||
|
@ -92,7 +92,6 @@ class ObjectListView(View):
|
|||||||
|
|
||||||
# Construct the table based on the user's permissions
|
# Construct the table based on the user's permissions
|
||||||
table = self.table(self.queryset)
|
table = self.table(self.queryset)
|
||||||
table.model = model
|
|
||||||
if 'pk' in table.base_columns and any([request.user.has_perm(perm) for perm in self.edit_permissions]):
|
if 'pk' in table.base_columns and any([request.user.has_perm(perm) for perm in self.edit_permissions]):
|
||||||
table.base_columns['pk'].visible = True
|
table.base_columns['pk'].visible = True
|
||||||
RequestConfig(request, paginate={'klass': EnhancedPaginator}).configure(table)
|
RequestConfig(request, paginate={'klass': EnhancedPaginator}).configure(table)
|
||||||
|
Loading…
Reference in New Issue
Block a user