Skip to content

Commit

Permalink
Proprietaire delete vehicule: fix http/500
Browse files Browse the repository at this point in the history
HTTP/500 was returned instead of 404 when the vehicule doesn't exist.
  • Loading branch information
brmzkw committed Feb 11, 2024
1 parent 4f89f17 commit dcb0c51
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mesads/vehicules_relais/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,11 @@ class ProprietaireVehiculeDeleteView(RevisionMixin, DeleteView):
model = Vehicule

def get_object(self, queryset=None):
return Vehicule.objects.filter(
return get_object_or_404(
Vehicule,
proprietaire_id=self.kwargs["proprietaire_id"],
numero=self.kwargs["vehicule_numero"],
).first()
)

def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
Expand Down

0 comments on commit dcb0c51

Please sign in to comment.