def mail(request): backend = DevEmailBackend() if request.method == 'POST': backend.clear() return redirect('zadmin.mail') return render(request, 'zadmin/mail.html', dict(mail=backend.view_all()))