示例#1
0
def book_info(request ,template_name = "registration/book_info.html" ):

    """ page containing a form that allows a customer to edit their booking information that
    will be displayed in the booking form next time they are logged in and go to checkout """

    if request.method == 'POST':
        postdata = request.POST.copy()
        form = UserProfileForm(postdata)
        if form.is_valid():
            profile.set(request)
            url = urlresolvers.reverse('my_account')
            return HttpResponseRedirect(url)
    else:
        user_profile = profile.retrieve(request)
        form = UserProfileForm(instance=user_profile)
    page_title = 'Edit Booking Information'
    return render_to_response(template_name,locals(),context_instance = RequestContext(request))
示例#2
0
def set(request):
    """ updates the information stored in the user's profile """
    profile = retrieve(request)
    profile_form = UserProfileForm(request.POST,instance=profile)
    profile_form.save()