def register(request): context = _common.get_register_context(request) if request.method == 'POST': context, form_valid = _common.check_register_form(request,context) if form_valid: return redirect(index) return _common.render_to_response2(request,'give/register.html',context)
def index(request): if request.method == 'GET': if request.user.is_authenticated(): return _common.render_to_response2( request, 'give/userpage.html', ) else: context = {'next': request.GET.get('next', None)} return _common.render_to_response2( request, 'give/welcome.html', context ) else: return login( request, template_name='give/welcome.html', authentication_form=DataloveAuthenticationForm )
def manage_account(request): context = _common.get_manage_account_context(request) if request.method == 'POST': form_valid = False if "user" in request.POST: context, form_valid = _common.check_user_form(request, context) elif "password" in request.POST: context, form_valid = _common.check_password_form(request, context) elif "profile" in request.POST: context, form_valid = _common.check_profile_form(request, context) if form_valid: return redirect(manage_account) return _common.render_to_response2( request, 'give/manage_account.html', context )
def widget(request): context = {'error': request.GET['error']} if 'error' in request.GET else {} if 'random' in request.GET and 'user' not in request.GET: context['profile'] = DataloveProfile.get_random_profile() elif 'user' in request.GET and 'random' not in request.GET: try: context['profile'] = DataloveProfile.objects.get( user__username=request.GET['user'] ) except DataloveProfile.DoesNotExist: context['error'] = "User '%s' does not exist" % request.GET['user'] else: return HttpResponseBadRequest( "GET request must have eather query parameter 'user' or " "'random'." ) return _common.render_to_response2(request, 'give/widget.html', context)
def profile(request, username): context = _common.get_profile_context(request,username) return _common.render_to_response2(request,'give/profile.html',context)
def unregister_confirm(request): return _common.render_to_response2(request,'give/unregister_confirm.html')
def users(request): context = _common.get_users_context(request) return _common.render_to_response2(request,'give/users.html',context)
def history(request,username): if request.user.username != username: return redirect('profile', username) context = _common.get_history_context(request) return _common.render_to_response2(request,'give/history.html',context)
def widget_doc(request): context = _common.get_widget_doc_context(request) return _common.render_to_response2(request, 'give/widget_doc.html', context)