summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--import_export/resources.py3
-rw-r--r--tests/core/tests/resources_tests.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/import_export/resources.py b/import_export/resources.py
index 3663ee4..ca542d7 100644
--- a/import_export/resources.py
+++ b/import_export/resources.py
@@ -371,7 +371,8 @@ class Resource(six.with_metaclass(DeclarativeMetaclass)):
return result
def get_export_order(self):
- return self._meta.export_order or self.fields.keys()
+ order = tuple (self._meta.export_order or ())
+ return order + tuple (k for k in self.fields.keys() if k not in order)
def export_field(self, field, obj):
field_name = self.get_field_name(field)
diff --git a/tests/core/tests/resources_tests.py b/tests/core/tests/resources_tests.py
index b3901d5..bbaee0b 100644
--- a/tests/core/tests/resources_tests.py
+++ b/tests/core/tests/resources_tests.py
@@ -33,6 +33,7 @@ except ImportError:
class MyResource(resources.Resource):
name = fields.Field()
email = fields.Field()
+ extra = fields.Field()
class Meta:
export_order = ('email', 'name')
@@ -57,7 +58,7 @@ class ResourceTestCase(TestCase):
def test_get_export_order(self):
self.assertEqual(self.my_resource.get_export_headers(),
- ['email', 'name'])
+ ['email', 'name', 'extra'])
class BookResource(resources.ModelResource):