diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6ce2ae2..e100544 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ All notable changes to WuttaSync will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+## v0.5.1 (2026-02-13)
+
+### Fix
+
+- fix source/target data order for import diff warning email
+- fix importer `get_keys()` logic to honor class attribute
+- add date type coercion logic for CSV importer
+
## v0.5.0 (2026-01-03)
### Feat
diff --git a/pyproject.toml b/pyproject.toml
index b61d057..d3db422 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
[project]
name = "WuttaSync"
-version = "0.5.0"
+version = "0.5.1"
description = "Wutta Framework for data import/export and real-time sync"
readme = "README.md"
authors = [{name = "Lance Edgar", email = "lance@wuttaproject.org"}]
diff --git a/src/wuttasync/email-templates/import_export_warning.html.mako b/src/wuttasync/email-templates/import_export_warning.html.mako
index 9be7770..cae4658 100644
--- a/src/wuttasync/email-templates/import_export_warning.html.mako
+++ b/src/wuttasync/email-templates/import_export_warning.html.mako
@@ -59,7 +59,7 @@
${model} - ${app.render_quantity(len(created) - max_diffs)} more records created in ${target_title} - not shown here
% endif
- % for obj, source_data, target_data in updated[:max_diffs]:
+ % for obj, target_data, source_data in updated[:max_diffs]:
${model} updated in ${target_title}: ${obj}
<% diff = make_diff(target_data, source_data, nature="update") %>
diff --git a/src/wuttasync/importing/base.py b/src/wuttasync/importing/base.py
index dd65190..183c1b9 100644
--- a/src/wuttasync/importing/base.py
+++ b/src/wuttasync/importing/base.py
@@ -379,8 +379,10 @@ class Importer: # pylint: disable=too-many-instance-attributes,too-many-public-
# nb. prefer 'keys' but use 'key' as fallback
if "keys" in self.__dict__:
keys = self.__dict__["keys"]
- elif "key" in self.__dict__:
- keys = self.__dict__["key"]
+ elif hasattr(self, "keys"):
+ keys = self.keys
+ elif hasattr(self, "key"):
+ keys = self.key
else:
keys = self.default_keys
diff --git a/tests/importing/test_base.py b/tests/importing/test_base.py
index 9f83ae3..cf49b1c 100644
--- a/tests/importing/test_base.py
+++ b/tests/importing/test_base.py
@@ -90,19 +90,24 @@ class TestImporter(DataTestCase):
imp = self.make_importer(model_class=model.User)
self.assertEqual(imp.get_keys(), ["uuid"])
- # class may define 'keys'
+ # object dict may define 'keys'
imp = self.make_importer(model_class=model.User)
- with patch.object(imp, "keys", new=["foo", "bar"], create=True):
+ with patch.dict(imp.__dict__, keys=["foo", "bar"]):
self.assertEqual(imp.get_keys(), ["foo", "bar"])
+ # class may define 'keys'
+ with patch.object(mod.Importer, "keys", new=["foo", "baz"], create=True):
+ imp = self.make_importer(model_class=model.User)
+ self.assertEqual(imp.get_keys(), ["foo", "baz"])
+
# class may define 'key'
- imp = self.make_importer(model_class=model.User)
- with patch.object(imp, "key", new="whatever", create=True):
+ with patch.object(mod.Importer, "key", new="whatever", create=True):
+ imp = self.make_importer(model_class=model.User)
self.assertEqual(imp.get_keys(), ["whatever"])
# class may define 'default_keys'
- imp = self.make_importer(model_class=model.User)
- with patch.object(imp, "default_keys", new=["baz", "foo"]):
+ with patch.object(mod.Importer, "default_keys", new=["baz", "foo"]):
+ imp = self.make_importer(model_class=model.User)
self.assertEqual(imp.get_keys(), ["baz", "foo"])
def test_process_data(self):