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 | 13cc881d6eb1da1ab4abed8dc11d2574ce37edda (patch) | |
tree | 0ff4927ac85605a24df691361e8306175abfbefb /ishtar_common/utils.py | |
parent | 93b83586f6b291ac4c4b2ac30ceb96aede1cf650 (diff) | |
download | Ishtar-13cc881d6eb1da1ab4abed8dc11d2574ce37edda.tar.bz2 Ishtar-13cc881d6eb1da1ab4abed8dc11d2574ce37edda.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}"), |