From 5aa11c751acecb6d5a3a56f45f74d17d64a358d1 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 16 Oct 2018 12:10:17 +0200 Subject: Natural keys for operations, context records, finds, etc. --- ishtar_common/models.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ishtar_common') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 0eade6891..a73ba8155 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -441,6 +441,11 @@ def post_save_cache(sender, **kwargs): sender.refresh_cache() +class ExternalIdManager(models.Manager): + def get_by_natural_key(self, external_id): + return self.get(external_id=external_id) + + class SlugModelManager(models.Manager): def get_by_natural_key(self, slug): return self.get(slug=slug) -- cgit v1.2.3