Skip to content

Commit

Permalink
fix missing redirects, fix multiple results
Browse files Browse the repository at this point in the history
  • Loading branch information
nicokant committed Jun 21, 2024
1 parent b573c9b commit 8436f4d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/genlab_bestilling/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self, *args, project, **kwargs):
self.fields["sample_types"].queryset = project.sample_types.all()
self.fields["markers"].queryset = Marker.objects.filter(
species__projects__id=project.id
)
).distinct()

def save(self, commit=True):
obj = super().save(commit=False)
Expand Down Expand Up @@ -210,7 +210,7 @@ class Meta:
),
"location": Selectize(search_lookup="name_icontains"),
"type": Selectize(search_lookup="name_icontains"),
"markers": Selectize(search_lookup="name_icontains"),
"markers": DualSortableSelector(search_lookup="name_icontains"),
"date": DateInput(),
"notes": forms.widgets.Textarea(attrs={"rows": 1, "cols": 10}),
}
Expand Down
16 changes: 14 additions & 2 deletions src/genlab_bestilling/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,23 @@ class ProjectUpdateView(FormsetUpdateView):
model = Project
form_class = ProjectForm

def get_success_url(self):
return reverse(
"project-detail",
kwargs={"pk": self.object.id},
)


class ProjectCreateView(FormsetCreateView):
model = Project
form_class = ProjectForm

def get_success_url(self):
return reverse(
"project-detail",
kwargs={"pk": self.object.id},
)


class ProjectNestedMixin(LoginRequiredMixin):
"""
Expand Down Expand Up @@ -173,7 +185,7 @@ def get_queryset(self) -> QuerySet[Any]:

def get_success_url(self):
return reverse(
"project-order-detail",
"project-equipment-detail",
kwargs={"project_id": self.project.id, "pk": self.object.id},
)

Expand All @@ -187,7 +199,7 @@ class EquipmentOrderCreateView(

def get_success_url(self):
return reverse(
"project-order-detail",
"project-equipment-detail",
kwargs={"project_id": self.project.id, "pk": self.object.id},
)

Expand Down

0 comments on commit 8436f4d

Please sign in to comment.