mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Use model's get_custom_fields
This commit is contained in:
@ -93,12 +93,11 @@ class ObjectListView(View):
|
|||||||
# Start with the column headers
|
# Start with the column headers
|
||||||
headers = self.queryset.model.csv_headers.copy()
|
headers = self.queryset.model.csv_headers.copy()
|
||||||
|
|
||||||
# Add custom field headers
|
# Add custom field headers, if any
|
||||||
content_type = ContentType.objects.get_for_model(self.queryset.model)
|
if hasattr(self.queryset.model, 'get_custom_fields'):
|
||||||
|
for custom_field in self.queryset.model().get_custom_fields():
|
||||||
for custom_field in CustomField.objects.filter(obj_type=content_type):
|
headers.append(custom_field.name)
|
||||||
headers.append(custom_field.name)
|
custom_fields.append(custom_field.name)
|
||||||
custom_fields.append(custom_field.name)
|
|
||||||
|
|
||||||
csv_data.append(','.join(headers))
|
csv_data.append(','.join(headers))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user