Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utiliser SimpleLazyObject pour PartnershipConfiguration #191

Open
SebCorbin opened this issue May 5, 2020 · 0 comments
Open

Utiliser SimpleLazyObject pour PartnershipConfiguration #191

SebCorbin opened this issue May 5, 2020 · 0 comments

Comments

@SebCorbin
Copy link
Contributor

SebCorbin commented May 5, 2020

Dans le fichier de models

config = SimpleLazyObject(PartnershipConfiguration.get_configuration)

@receiver(post_save, sender=PartnershipConfiguration)
def reload_config(sender, **kwargs):
    config._setup()

Pourrait être utilisé ensuite dans les autres fichiers de manière beacoup plus courte, et sans devoir refaire une requête :

from partnership.model import config

config.get_current_academic_year_for_creation_modification()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant