Private
Public Access
1
0

small fix

This commit is contained in:
Sander Roosendaal
2019-09-09 17:09:48 +02:00
parent 1180b72edc
commit 754f979397
2 changed files with 7 additions and 4 deletions

View File

@@ -5351,10 +5351,13 @@ class WorkoutDelete(DeleteView):
workout_pk = self.kwargs['pk']
try:
obj = Workout.objects.get(pk=workout_pk)
except Workout.DoesNotExist:
except (ValueError,Workout.DoesNotExist):
workout_pk = encoder.decode_hex(workout_pk)
obj = Workout.objects.get(pk=workout_pk)
# obj = super(WorkoutDelete, self).get_object(*args, **kwargs)
try:
obj = Workout.objects.get(pk=workout_pk)
except Workout.DoesNotExist:
raise Http404("One of the workouts doesn't exist")
# obj = super(WorkoutDelete, self).get_object(*args, **kwargs)
if not checkaccessuser(self.request.user,obj.user):
raise PermissionDenied('You are not allowed to delete this workout')