summaryrefslogtreecommitdiff
path: root/ishtar_common/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/utils.py')
-rw-r--r--ishtar_common/utils.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py
index 7b708cd76..dd2f3afe3 100644
--- a/ishtar_common/utils.py
+++ b/ishtar_common/utils.py
@@ -1240,11 +1240,15 @@ def get_all_field_names(model):
)
-def get_all_related_m2m_objects_with_model(model):
+def get_all_related_m2m_objects_with_model(model, related_name=None):
+ for f in model._meta.get_fields(include_hidden=True):
+ if f.many_to_many and f.auto_created:
+ print(f.related_name)
return [
(f, f.model if f.model != model else None)
for f in model._meta.get_fields(include_hidden=True)
- if f.many_to_many and f.auto_created
+ if f.many_to_many and f.auto_created and
+ (not related_name or f.related_name.startswith(related_name))
]