small fix
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user