diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-20 12:37:21 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-20 13:04:05 +0100 |
commit | b1d246d7045e07200b21049a714027dd72060f84 (patch) | |
tree | 8549ee5ced0ff1a90eedb1d14fd450d71ac16e96 /archaeological_operations | |
parent | f3926450e8b990a8b773aa76c5d58c63fdc5758d (diff) | |
download | Ishtar-b1d246d7045e07200b21049a714027dd72060f84.tar.bz2 Ishtar-b1d246d7045e07200b21049a714027dd72060f84.zip |
✨ wizards: improve performance when many are attached
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/forms.py | 4 | ||||
-rw-r--r-- | archaeological_operations/models.py | 2 | ||||
-rw-r--r-- | archaeological_operations/wizards.py | 10 |
3 files changed, 3 insertions, 13 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 72d2eaf35..6a76c4197 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -717,9 +717,7 @@ class OperationFormGeneral(CustomForm, ManageOldType): address = forms.CharField(label=_("Address / Locality"), required=False, max_length=500, widget=forms.Textarea) town = widgets.Select2MultipleField( - label=_("Towns"), - model=Town, - required=False, remote=True) + label=_("Towns"), model=Town, long_widget=True, required=False, remote=True) year = forms.IntegerField(label=_("Year"), initial=lambda: datetime.datetime.now().year, validators=[validators.MinValueValidator(1000), diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index d933944d1..fe6ed584e 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -2724,6 +2724,8 @@ def operation_town_m2m_changed(sender, **kwargs): operation = kwargs.get("instance", None) if not operation: return + if getattr(operation, "_no_m2m_process", None): + return operation._prevent_loop = False operation.regenerate_all_ids() geotown_attached_changed(sender, **kwargs) diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index 74840e552..94d6b49f9 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -87,7 +87,6 @@ class OperationWizard(Wizard): Return extra context for templates """ context = super(OperationWizard, self).get_context_data(form, **kwargs) - step = self.steps.current # reminder of the current file reminder = self.get_reminder() if reminder: @@ -198,15 +197,6 @@ class OperationModificationWizard(OperationWizard): modification = True filter_owns = {"selec-operation_modification": ["pk"]} - def get_form_kwargs(self, step, **kwargs): - kwargs = super(OperationModificationWizard, self).get_form_kwargs( - step, **kwargs - ) - if step != "relations-operation_modification": - return kwargs - kwargs["left_record"] = self.get_current_object() - return kwargs - class OperationClosingWizard(ClosingWizard): model = models.Operation |