Exemple #1
0
def signup_view(request, event, alternative_form_slug=None):
    """
    This is the "gate" function. The implementation is in
    `actual_signup_view`.

    The purpose of this function is to redirect new users through the process
    of registering an account, entering qualifications and only then signing up.
    Existing users are welcomed to sign up right away.
    """

    if alternative_form_slug:
        actual_signup_url = url('labour:special_signup_view', event.slug,
                                alternative_form_slug)
    else:
        actual_signup_url = url('labour:signup_view', event.slug)

    if not request.user.is_authenticated:
        pages = [
            ('core_login_view', _('Sign up or sign in...'), login_related()),
            ('labour:qualifications_view', _('Revise qualifications'),
             qualifications_related()),
            (actual_signup_url, _('Apply for volunteer work')),
        ]

        page_wizard_init(request, pages)
        return login_redirect(request)

    try:
        person = request.user.person
    except Person.DoesNotExist:
        pages = [
            ('core_personify_view', _('Complete contact information')),
            ('labour:qualifications_view', _('Revise qualifications'),
             qualifications_related()),
            (actual_signup_url, _('Apply for volunteer work')),
        ]

        page_wizard_init(request, pages)
        return redirect('core_personify_view')

    return actual_signup_view(request,
                              event,
                              alternative_form_slug=alternative_form_slug)
Exemple #2
0
def labour_signup_view(request, event, alternative_form_slug=None):
    """
    This is the "gate" function. The implementation is in
    `actual_labour_signup_view`.

    The purpose of this function is to redirect new users through the process
    of registering an account, entering qualifications and only then signing up.
    Existing users are welcomed to sign up right away.
    """

    if alternative_form_slug:
        actual_signup_url = url('labour_special_signup_view', event.slug, alternative_form_slug)
    else:
        actual_signup_url = url('labour_signup_view', event.slug)

    if not request.user.is_authenticated:
        pages = [
            ('core_login_view', _('Sign up or sign in...'), login_related()),
            ('labour_qualifications_view', _('Revise qualifications'), qualifications_related()),
            (actual_signup_url, _('Apply for volunteer work')),
        ]

        page_wizard_init(request, pages)
        return login_redirect(request)

    try:
        person = request.user.person
    except Person.DoesNotExist:
        pages = [
            ('core_personify_view', _('Complete contact information')),
            ('labour_qualifications_view', _('Revise qualifications'), qualifications_related()),
            (actual_signup_url, _('Apply for volunteer work')),
        ]

        page_wizard_init(request, pages)
        return redirect('core_personify_view')

    return actual_labour_signup_view(request, event, alternative_form_slug=alternative_form_slug)