@login_required
@staff_member_required
@permission_required('wiki.purge_document')
@check_readonly
def purge_view(request):
 selected = request.GET.get('ids', '').split(',')
 to_purge = Document.deleted_objects.filter(id__in=selected)
 if (request.method == 'POST'):
  if request.POST.get('confirm_purge', False):
   purged = 0
   for doc in to_purge:
    doc.purge()
    purged += 1
   messages.info(request, ('%s document(s) were purged.' % purged))
  return HttpResponseRedirect('/admin/wiki/document/')
 return TemplateResponse(request, 'admin/wiki/purge_documents.html', {'to_purge': to_purge})

@ login_required @ staff_member_required @ permission_required ( 'wiki.purge_document' ) @ check_readonly def purge_view ( request ) : selected = request . GET . get ( 'ids' , '' ) . split ( ',' ) to_purge = Document . deleted_objects . filter ( id__in = selected ) if ( request . method == 'POST' ) : if request . POST . get ( 'confirm_purge' , False ) : purged = 0 for doc in to_purge : doc . purge ( ) purged += 1 messages . info ( request , ( '%s document(s) were purged.' % purged ) ) return HttpResponseRedirect ( '/admin/wiki/document/' ) return TemplateResponse ( request , 'admin/wiki/purge_documents.html' , { 'to_purge' : to_purge } )
interstitial admin view for purging multiple documents .