diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-04-11 15:12:06 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-06-17 13:21:27 +0200 |
commit | b7ca2ac599a3ea7c42a76969ea6c320732e52b7b (patch) | |
tree | f9cb2ff7f0f534b2e6bd67493feb2da3a2b2580a /ishtar_common | |
parent | e11af2c30cdcca2f49e151aafe87a00c0313704c (diff) | |
download | Ishtar-b7ca2ac599a3ea7c42a76969ea6c320732e52b7b.tar.bz2 Ishtar-b7ca2ac599a3ea7c42a76969ea6c320732e52b7b.zip |
lazy evaluation of profile mapping
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/forms.py | 4 | ||||
-rw-r--r-- | ishtar_common/models.py | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 9b1e2da48..3a696911d 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -704,8 +704,8 @@ def get_form_selection( widget_kwargs['source_full'] = reverse_lazy(get_full_url) if gallery: widget_kwargs['gallery'] = True - if map and models.get_current_profile().mapping: - widget_kwargs['map'] = True + if map: + widget_kwargs['map'] = models.profile_mapping() attrs[key] = forms.IntegerField( label="", required=False, validators=[models.valid_id(model)], diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 4d699bfd8..74151fa31 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -2620,6 +2620,13 @@ def get_current_profile(force=False): return IshtarSiteProfile.get_current_profile(force=force) +def _profile_mapping(): + return get_current_profile().mapping + + +profile_mapping = lazy(_profile_mapping) + + def cached_site_changed(sender, **kwargs): get_current_profile(force=True) from ishtar_common.menus import Menu |