예제 #1
0
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)    
예제 #2
0
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
            )
예제 #3
0
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
        )
예제 #4
0
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)
예제 #5
0
def profile(request, username):
    context = _common.get_profile_context(request,username)
    return _common.render_to_response2(request,'give/profile.html',context)
예제 #6
0
def unregister_confirm(request):
    return _common.render_to_response2(request,'give/unregister_confirm.html')
예제 #7
0
def users(request):
    context = _common.get_users_context(request)
    return _common.render_to_response2(request,'give/users.html',context)
예제 #8
0
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)
예제 #9
0
def widget_doc(request):
    context = _common.get_widget_doc_context(request)
    return _common.render_to_response2(request, 'give/widget_doc.html', context)