1
0
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:
Saria Hajjar
2020-01-23 17:18:58 +00:00
parent 9128435113
commit 0ab19d723d

View File

@ -91,16 +91,16 @@ class ObjectListView(View):
custom_fields = []
# Start with the column headers
headers = ','.join(self.queryset.model.csv_headers)
headers = self.queryset.model.csv_headers.copy()
# Add custom field headers
content_type = ContentType.objects.get_for_model(self.queryset.model)
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)
csv_data.append(headers)
csv_data.append(','.join(headers))
# Iterate through the queryset appending each object
for obj in self.queryset: