mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Moved the header join logic after the custom fields are added
This commit is contained in:
@ -91,16 +91,16 @@ class ObjectListView(View):
|
|||||||
custom_fields = []
|
custom_fields = []
|
||||||
|
|
||||||
# Start with the column headers
|
# Start with the column headers
|
||||||
headers = ','.join(self.queryset.model.csv_headers)
|
headers = self.queryset.model.csv_headers.copy()
|
||||||
|
|
||||||
# Add custom field headers
|
# Add custom field headers
|
||||||
content_type = ContentType.objects.get_for_model(self.queryset.model)
|
content_type = ContentType.objects.get_for_model(self.queryset.model)
|
||||||
|
|
||||||
for custom_field in CustomField.objects.filter(obj_type=content_type):
|
for custom_field in CustomField.objects.filter(obj_type=content_type):
|
||||||
headers += ',cf_{}'.format(custom_field.name)
|
headers.append(custom_field.name)
|
||||||
custom_fields.append(custom_field.name)
|
custom_fields.append(custom_field.name)
|
||||||
|
|
||||||
csv_data.append(headers)
|
csv_data.append(','.join(headers))
|
||||||
|
|
||||||
# Iterate through the queryset appending each object
|
# Iterate through the queryset appending each object
|
||||||
for obj in self.queryset:
|
for obj in self.queryset:
|
||||||
|
Reference in New Issue
Block a user