fix deleting changesets
@@ -138,12 +138,14 @@ def changeset_detail(request, pk):
return render(request, 'editor/changeset_apply.html', {})
elif request.POST.get('delete') == '1':
+ with changeset.lock_to_edit() as changeset:
if not changeset.can_delete(request):
- raise PermissionDenied
+ messages.error(request, _('You cannot delete this change set.'))
if request.POST.get('delete_confirm') == '1':
changeset.delete()
- return redirect(reverse('editor.index'))
+ messages.error(request, _('You deleted this change set.'))
+ return redirect(reverse('editor.users.detail', kwargs={'pk': request.user.pk}))
return render(request, 'editor/delete.html', {
'model_title': ChangeSet._meta.verbose_name,
