From 54f1404aadea27ecbae51978bfbd673b9e40d25d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 3 Jan 2020 17:26:41 +0100 Subject: Extra actions: regenerate external_id --- ishtar_common/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index d22a89916..aae2783c7 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -1483,6 +1483,14 @@ def find_all_symlink(dirname): yield full, os.readlink(full) +def get_model_by_slug(slug): + all_models = apps.get_models() + for model in all_models: + if hasattr(model, "SLUG") and model.SLUG == slug: + return model + return + + MEDIA_RE = [ re.compile(r"_[a-zA-Z0-9]{7}\-[0-9]"), re.compile(r"_[a-zA-Z0-9]{7}"), -- cgit v1.2.3