Beispiel #1
0
def register(request, template, contributor=False):
    """Register a new user.

    :param contributor: If True, this is for registering a new contributor.

    """
    if request.method == "GET" and not request.MOBILE:
        url = reverse("users.auth") + "?" + request.GET.urlencode()
        return HttpResponsePermanentRedirect(url)

    form = handle_register(request)
    if form.is_valid():
        return render(request, template + "register_done.html")

    if request.MOBILE:
        return render(request, template + "register.html", {"form": form})

    return user_auth(request, register_form=form)
Beispiel #2
0
def register(request, template, contributor=False):
    """Register a new user.

    :param contributor: If True, this is for registering a new contributor.

    """
    if request.method == 'GET' and not request.MOBILE:
        url = reverse('users.auth') + '?' + request.GET.urlencode()
        return HttpResponsePermanentRedirect(url)

    form = handle_register(request)
    if form.is_valid():
        return render(request, template + 'register_done.html')

    if request.MOBILE:
        return render(request, template + 'register.html', {'form': form})

    return user_auth(request, register_form=form, contributor=contributor)
Beispiel #3
0
def register(request, template, contributor=False):
    """Register a new user.

    :param contributor: If True, this is for registering a new contributor.

    """
    if request.method == 'GET' and not request.MOBILE:
        url = reverse('users.auth') + '?' + request.GET.urlencode()
        return HttpResponsePermanentRedirect(url)

    form = handle_register(request)
    if form.is_valid():
        return render(request, template + 'register_done.html')

    if request.MOBILE:
        return render(request, template + 'register.html', {
            'form': form})

    return user_auth(request, register_form=form, contributor=contributor)