web3auth/views.py
def signup_view(request, template_name='web3auth/signup.html'):
    """
    1. Creates an instance of a SignupForm.
    2. Checks if the registration is enabled.
    3. If the registration is closed or form has errors, returns form with errors
    4. If the form is valid, saves the user without saving to DB
    5. Sets the user address from the form, saves it to DB
    6. Logins the user using web3auth.backend.Web3Backend
    7. Redirects the user to LOGIN_REDIRECT_URL or 'next' in get or post params
    :param request: Django request
    :param template_name: Template to render
    :return: rendered template with form
    """
    form = SignupForm()
    if not app_settings.WEB3AUTH_SIGNUP_ENABLED:
        form.add_error(None, _("Sorry, signup's are currently disabled"))
    else:
        if request.method == 'POST':
            form = SignupForm(request.POST)
            if form.is_valid():
                user = form.save(commit=False)
                addr_field = app_settings.WEB3AUTH_USER_ADDRESS_FIELD
                setattr(user, addr_field, form.cleaned_data[addr_field])
                user.save()
                login(request, user, 'web3auth.backend.Web3Backend')
                return redirect(get_redirect_url(request))
    return render(request,
                  template_name,
                  {'form': form})

    1. Creates an instance of a SignupForm.
    2. Checks if the registration is enabled.
    3. If the registration is closed or form has errors, returns form with errors
    4. If the form is valid, saves the user without saving to DB
    5. Sets the user address from the form, saves it to DB
    6. Logins the user using web3auth.backend.Web3Backend
    7. Redirects the user to LOGIN_REDIRECT_URL or 'next' in get or post params
    :param request: Django request
    :param template_name: Template to render
    :return: rendered template with form
    
1. Creates an instance of a SignupForm.
2. Checks if the registration is enabled.
3. If the registration is closed or form has errors, returns form with errors
4. If the form is valid, saves the user without saving to DB
5. Sets the user address from the form, saves it to DB
6. Logins the user using web3auth.backend.Web3Backend
7. Redirects the user to LOGIN_REDIRECT_URL or 'next' in get or post params
1 . Creates an instance of a SignupForm . 2 . Checks if the registration is enabled . 3 . If the registration is closed or form has errors returns form with errors 4 . If the form is valid saves the user without saving to DB 5 . Sets the user address from the form saves it to DB 6 . Logins the user using web3auth . backend . Web3Backend 7 . Redirects the user to LOGIN_REDIRECT_URL or ' next ' in get or post params
def signup_view(request, template_name='web3auth/signup.html'):
    form = SignupForm()
    if not app_settings.WEB3AUTH_SIGNUP_ENABLED:
        form.add_error(None, _("Sorry, signup's are currently disabled"))
    else:
        if request.method == 'POST':
            form = SignupForm(request.POST)
            if form.is_valid():
                user = form.save(commit=False)
                addr_field = app_settings.WEB3AUTH_USER_ADDRESS_FIELD
                setattr(user, addr_field, form.cleaned_data[addr_field])
                user.save()
                login(request, user, 'web3auth.backend.Web3Backend')
                return redirect(get_redirect_url(request))
    return render(request,
                  template_name,
                  {'form': form})
def signup_view ( request , template_name = 'web3auth/signup.html' ) : form = SignupForm ( ) if not app_settings . WEB3AUTH_SIGNUP_ENABLED : form . add_error ( None , _ ( "Sorry, signup's are currently disabled" ) ) else : if request . method == 'POST' : form = SignupForm ( request . POST ) if form . is_valid ( ) : user = form . save ( commit = False ) addr_field = app_settings . WEB3AUTH_USER_ADDRESS_FIELD setattr ( user , addr_field , form . cleaned_data [ addr_field ] ) user . save ( ) login ( request , user , 'web3auth.backend.Web3Backend' ) return redirect ( get_redirect_url ( request ) ) return render ( request , template_name , { 'form' : form } )
1.
1 .
"""
    1. Creates an instance of a SignupForm.
    2. Checks if the registration is enabled.
    3. If the registration is closed or form has errors, returns form with errors
    4. If the form is valid, saves the user without saving to DB
    5. Sets the user address from the form, saves it to DB
    6. Logins the user using web3auth.backend.Web3Backend
    7. Redirects the user to LOGIN_REDIRECT_URL or 'next' in get or post params
    :param request: Django request
    :param template_name: Template to render
    :return: rendered template with form
    """
rendered template with form
rendered template with form
request
None
template_name
Template to render
Template to render