summaryrefslogtreecommitdiff
path: root/archaeological_files/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files/views.py')
-rw-r--r--archaeological_files/views.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/archaeological_files/views.py b/archaeological_files/views.py
index b9c4395f5..3ed24f63b 100644
--- a/archaeological_files/views.py
+++ b/archaeological_files/views.py
@@ -452,7 +452,10 @@ class PreventiveEditView(IshtarMixin, LoginRequiredMixin, MixFormFormsetUpdateVi
return inlines
def get_success_url(self):
- return reverse("file-edit-preventive", args=[self.object.pk])
+ url = reverse("file-edit-preventive", args=[self.object.pk])
+ if getattr(self, "current_tab", None):
+ url += "?current_tab=" + self.current_tab
+ return url
def get_form_kwargs(self):
kwargs = super(PreventiveEditView, self).get_form_kwargs()
@@ -487,8 +490,13 @@ class PreventiveEditView(IshtarMixin, LoginRequiredMixin, MixFormFormsetUpdateVi
flat_rates.update(form.flat_rates)
context["form_unities"] = unities.items()
context["form_flat_rates"] = flat_rates
+ context["current_tab"] = self.request.GET.get("current_tab", None) or "planned"
return context
+ def form_valid(self, form, inline_forms):
+ self.current_tab = self.request.POST.get("current_tab", None) or "planned"
+ return super(PreventiveEditView, self).form_valid(form, inline_forms)
+
def file_edit_preventive_add_default(request, pk, current_right=None):
job_attrs = (
@@ -536,4 +544,6 @@ def file_edit_preventive_copy_planned(request, pk, current_right=None):
quantity_by_day_worked=F("quantity_by_day_planned"),
days_worked=F("days_planned"),
)
- return redirect(reverse("file-edit-preventive", kwargs={"pk": pk}))
+ return redirect(
+ reverse("file-edit-preventive", kwargs={"pk": pk}) + "?current_tab=worked"
+ )