diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-01-03 17:26:41 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-01-03 17:26:41 +0100 |
commit | 54f1404aadea27ecbae51978bfbd673b9e40d25d (patch) | |
tree | 0ff4927ac85605a24df691361e8306175abfbefb /ishtar_common/utils.py | |
parent | 842ce120106ccb604e160102c63eb1326f899fb3 (diff) | |
download | Ishtar-54f1404aadea27ecbae51978bfbd673b9e40d25d.tar.bz2 Ishtar-54f1404aadea27ecbae51978bfbd673b9e40d25d.zip |
Extra actions: regenerate external_id
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r-- | ishtar_common/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
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}"), |