def feedback(request): """ """ if request.method == "POST": form = FeedbackForm(request.user, data=request.POST) if form.is_valid(): context = { 'user': request.user, 'email': request.user.is_authenticated() and request.user.email or form.cleaned_data.get('email', None), 'message': form.cleaned_data['message'], 'name': request.user.is_authenticated() and request.user.username or form.cleaned_data.get('name', None), 'ip': request.META['REMOTE_ADDR'], } recipients = User.objects.filter(is_superuser=True) send_template_email(recipients, "notifications/feedback.html", context) msg = _('Thanks for the feedback!') request.user.message_set.create(message=msg, level=messages_extends.SUCCESS_PERSISTENT) return HttpResponseRedirect(get_next_url(request)) else: form = FeedbackForm(request.user, initial={'next':get_next_url(request)}) return render_to_response('feedback.html', {'form': form}, context_instance=RequestContext(request))
def process_view(self, request, view_func, view_args, view_kwargs): if "cancel" not in request.REQUEST: return message = getattr(view_func, "CANCEL_MESSAGE", None) or "action canceled" messages.success(request, message) return redirect(get_next_url(request))
def logout(request): # F. CRESPEL EDIT 2013-01-28: added setting to allow bypassing the logout confirmation page if settings.IMMEDIATE_LOGOUT: return HttpResponseRedirect(reverse('user_signout')) return render_to_response('logout.html', { 'next' : get_next_url(request), }, context_instance=RequestContext(request))
def process_view(self, request, view_func, view_args, view_kwargs): if 'cancel' in request.REQUEST: #todo use session messages for the anonymous users try: msg = getattr(view_func,'CANCEL_MESSAGE') except AttributeError: msg = 'action canceled' request.user.message_set.create(message=msg) return HttpResponseRedirect(get_next_url(request)) else: return None
def feedback(request): if request.method == "POST": form = FeedbackForm(request.user, data=request.POST) if form.is_valid(): context = { "user": request.user, "email": request.user.is_authenticated() and request.user.email or form.cleaned_data.get("email", None), "message": form.cleaned_data["message"], "name": request.user.is_authenticated() and request.user.username or form.cleaned_data.get("name", None), "ip": request.META["REMOTE_ADDR"], } recipients = User.objects.filter(is_superuser=True) send_template_email(recipients, "notifications/feedback.html", context) msg = _("Thanks for the feedback!") messages.info(request, msg) return HttpResponseRedirect(get_next_url(request)) else: form = FeedbackForm(request.user, initial={"next": get_next_url(request)}) return render_to_response("feedback.html", {"form": form}, context_instance=RequestContext(request))
def logout(request): return render_to_response('logout.html', { 'next' : get_next_url(request), }, context_instance=RequestContext(request))
def logout(request): return render_response('logout.html', { 'next' : get_next_url(request), }, request)
def logout(request): # Skip the stupid logout page step. return HttpResponseRedirect('%s?next=%s' % ( reverse('user_signout'), get_next_url(request)))
def logout(request): return render_to_response("logout.html", {"next": get_next_url(request)}, context_instance=RequestContext(request))