diff options
Diffstat (limited to 'archaeological_finds')
| -rw-r--r-- | archaeological_finds/models_finds.py | 12 | ||||
| -rw-r--r-- | archaeological_finds/views.py | 5 |
2 files changed, 13 insertions, 4 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 6104587c2..353d96faf 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -3600,7 +3600,7 @@ class Find( set_static_localisation_9.post_save = True - def update_current_full_location(self, full_location=None): + def update_current_full_location(self, full_location=None, return_value=False): """ If relevant update full location of current container :param full_location: provided if update is triggered from container @@ -3614,14 +3614,18 @@ class Find( full_location = self.container.generate_full_location() if full_location == self.container_fisrt_full_location: return False + if return_value: + return full_location self.container_fisrt_full_location = full_location else: if self.container_fisrt_full_location == "": return False + if return_value: + return "" self.container_fisrt_full_location = "" return True - def update_ref_full_location(self, full_location=None): + def update_ref_full_location(self, full_location=None, return_value=False): """ If relevant update full location of reference container :param full_location: provided if update is triggered from container @@ -3635,10 +3639,14 @@ class Find( full_location = self.container_ref.generate_full_location() if full_location == self.container_ref_fisrt_full_location: return False + if return_value: + return full_location self.container_ref_fisrt_full_location = full_location else: if self.container_ref_fisrt_full_location == "": return False + if return_value: + return "" self.container_ref_fisrt_full_location = "" return True diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index d8b5a3c64..118283d18 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -1355,8 +1355,9 @@ class QAFindDuplicateFormView(QAItemForm): return kwargs def form_valid(self, form): - form.save() - return HttpResponseRedirect(reverse("success")) + find = form.save() + url = reverse(models.Find.SHOW_URL, kwargs={"pk": find.pk}) + return HttpResponseRedirect(reverse("success") + f"?load_window={url}") def get_context_data(self, **kwargs): data = super(QAFindDuplicateFormView, self).get_context_data(**kwargs) |
