Example #1
0
def _get_wizard(request, all_plans=False):
    """
    Returns wizard instance depending on user registration status
    """
    if request.user.is_authenticated():
        current_plan = MemberRentalPlan.get_current_plan(request.user)
        if current_plan:
            if current_plan.status in [RentalPlanStatus.CanceledP, RentalPlanStatus.Collection]:
                return redirect('members:rent_list')
            wizard = ChangeRentPlanWizard.create(request, all_plans=all_plans)
        else:
            wizard = MemberRentSignUpWizard.create(request)
    else:
        if not request.is_ajax():
            return redirect('catalog:index')
        wizard = NonMemberRentSignUpWizard.create(request)
    return wizard(request)
Example #2
0
def change_rent_plan2(request):
    if not request.is_ajax():
        return redirect('/')
    wizard = NonMemberRentSignUpWizard.create(request, initial={1: request.REQUEST})
    return wizard(request)