Răsfoiți Sursa

Upgraded django-tables2 to v2.0.2

Jeremy Stretch 7 ani în urmă
părinte
comite
b05171b126
4 a modificat fișierele cu 8 adăugiri și 14 ștergeri
  1. 1 6
      netbox/dcim/tables.py
  2. 5 5
      netbox/ipam/views.py
  3. 1 2
      netbox/utilities/views.py
  4. 1 1
      requirements.txt

+ 1 - 6
netbox/dcim/tables.py

@@ -623,11 +623,6 @@ class CableTable(BaseTable):
         args=[Accessor('pk')],
         args=[Accessor('pk')],
         verbose_name='ID'
         verbose_name='ID'
     )
     )
-    # django-tables2 adds CSS `class="label"` which causes rendering issues
-    label_ = tables.Column(
-        accessor=Accessor('label'),
-        verbose_name='Label'
-    )
     termination_a_parent = tables.TemplateColumn(
     termination_a_parent = tables.TemplateColumn(
         template_code=CABLE_TERMINATION_PARENT,
         template_code=CABLE_TERMINATION_PARENT,
         accessor=Accessor('termination_a'),
         accessor=Accessor('termination_a'),
@@ -659,7 +654,7 @@ class CableTable(BaseTable):
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = Cable
         model = Cable
         fields = (
         fields = (
-            'pk', 'id', 'label_', 'termination_a_parent', 'termination_a', 'termination_b_parent', 'termination_b',
+            'pk', 'id', 'label', 'termination_a_parent', 'termination_a', 'termination_b_parent', 'termination_b',
             'status', 'type', 'color', 'length',
             'status', 'type', 'color', 'length',
         )
         )
 
 

+ 5 - 5
netbox/ipam/views.py

@@ -336,7 +336,7 @@ class AggregateView(View):
             prefix_table.columns.show('pk')
             prefix_table.columns.show('pk')
 
 
         paginate = {
         paginate = {
-            'klass': EnhancedPaginator,
+            'paginator_class': EnhancedPaginator,
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
         }
         }
         RequestConfig(request, paginate).configure(prefix_table)
         RequestConfig(request, paginate).configure(prefix_table)
@@ -512,7 +512,7 @@ class PrefixPrefixesView(View):
             prefix_table.columns.show('pk')
             prefix_table.columns.show('pk')
 
 
         paginate = {
         paginate = {
-            'klass': EnhancedPaginator,
+            'paginator_class': EnhancedPaginator,
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
         }
         }
         RequestConfig(request, paginate).configure(prefix_table)
         RequestConfig(request, paginate).configure(prefix_table)
@@ -551,7 +551,7 @@ class PrefixIPAddressesView(View):
             ip_table.columns.show('pk')
             ip_table.columns.show('pk')
 
 
         paginate = {
         paginate = {
-            'klass': EnhancedPaginator,
+            'paginator_class': EnhancedPaginator,
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
         }
         }
         RequestConfig(request, paginate).configure(ip_table)
         RequestConfig(request, paginate).configure(ip_table)
@@ -840,7 +840,7 @@ class VLANGroupVLANsView(View):
         vlan_table.columns.hide('group')
         vlan_table.columns.hide('group')
 
 
         paginate = {
         paginate = {
-            'klass': EnhancedPaginator,
+            'paginator_class': EnhancedPaginator,
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
         }
         }
         RequestConfig(request, paginate).configure(vlan_table)
         RequestConfig(request, paginate).configure(vlan_table)
@@ -899,7 +899,7 @@ class VLANMembersView(View):
         members_table = tables.VLANMemberTable(members)
         members_table = tables.VLANMemberTable(members)
 
 
         paginate = {
         paginate = {
-            'klass': EnhancedPaginator,
+            'paginator_class': EnhancedPaginator,
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
         }
         }
         RequestConfig(request, paginate).configure(members_table)
         RequestConfig(request, paginate).configure(members_table)

+ 1 - 2
netbox/utilities/views.py

@@ -25,7 +25,6 @@ from django_tables2 import RequestConfig
 from extras.models import CustomField, CustomFieldValue, ExportTemplate
 from extras.models import CustomField, CustomFieldValue, ExportTemplate
 from utilities.utils import queryset_to_csv
 from utilities.utils import queryset_to_csv
 from utilities.forms import BootstrapMixin, CSVDataField
 from utilities.forms import BootstrapMixin, CSVDataField
-from .constants import M2M_FIELD_TYPES
 from .error_handlers import handle_protectederror
 from .error_handlers import handle_protectederror
 from .forms import ConfirmationForm
 from .forms import ConfirmationForm
 from .paginator import EnhancedPaginator
 from .paginator import EnhancedPaginator
@@ -138,7 +137,7 @@ class ObjectListView(View):
 
 
         # Apply the request context
         # Apply the request context
         paginate = {
         paginate = {
-            'klass': EnhancedPaginator,
+            'paginator_class': EnhancedPaginator,
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
             'per_page': request.GET.get('per_page', settings.PAGINATE_COUNT)
         }
         }
         RequestConfig(request, paginate).configure(table)
         RequestConfig(request, paginate).configure(table)

+ 1 - 1
requirements.txt

@@ -3,7 +3,7 @@ django-cors-headers==2.4.0
 django-debug-toolbar==1.10.1
 django-debug-toolbar==1.10.1
 django-filter==2.0.0
 django-filter==2.0.0
 django-mptt==0.9.1
 django-mptt==0.9.1
-django-tables2==1.21.2
+django-tables2==2.0.2
 django-taggit==0.23.0
 django-taggit==0.23.0
 django-taggit-serializer==0.1.7
 django-taggit-serializer==0.1.7
 django-timezone-field==3.0
 django-timezone-field==3.0