Overriding signup/login form parameters and style

135 views
Skip to first unread message

Skyler Saleebyan

unread,
Nov 29, 2017, 7:41:53 PM11/29/17
to django-allauth
I've been trying to look through the docs and I'm still uncertain as to how I can override the actual login/signup forms that are used by allauth. For the most part I just want to change the presentation style, though besides that I want to add a DOB to my signup form. So far the furthest I've gotten is overriding base.html to adjust text and colors roughly in line with the rest of my site.

Current:



Desired output:



Ultimately I also want to make the login/signup also embedded in my navbar so this is definitely a preferred way of doing things.


Michael Schietzsch

unread,
Dec 4, 2017, 5:30:04 AM12/4/17
to django-allauth
Well the documentation does not explain that at all. I am currently also working on the same problem.
What I already done:
I have a working login in a ever present nav bar, and ich have an modal register form.
This is all done just with template editing, problem with that is, that I can not find a way to catch errors on login, that will always redirect to the original /accounts/ url...

    {% if user.is_authenticated == False %}
   <form class="form-inline" action="{% url 'account_login' %}" method="post">
     {% csrf_token %}
     <input type="hidden" name="next" value="{{ request.get_full_path }}" />
     <label class="sr-only" for="id_login"></label>
     <input class="form-control p-1 mb-2 mr-sm-2 mb-sm-0" id="id_login" name="login" placeholder="Username or e-mail" type="text"
       required />
     <label class="sr-only" for="id_password"></label>
     <input class="form-control p-1" id="id_password" name="password" placeholder="Password" type="password" required />
     <button type="submit" class="btn btn-primary btn-sm">Login</button>
     <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#LoginModal">Login2</button>
   </form>
   <div class="p-1 mb-2 mr-sm-2 mb-sm-0">
     <button type="button" class="btn btn-outline-info btn-sm" data-toggle="modal" data-target="#RegisterModal">Register</button>
   </div>
   {% else %}
   <form class="form-inline" action="{% url 'account_logout' %}" method="post">
     {% csrf_token %}
     <div class="p-1 mb-2 mr-sm-2 mb-sm-0">
       {% url 'profile' as profile_url %} {% if request.get_full_path == profile_url %}
       <button type="button" class="btn btn-outline-success btn-sm active" onClick="javascript:history.go(-1);">{% user_display user %}</button>
       {% else %}
       <a class="btn btn-outline-success btn-sm" href="/profile" role="button">{% user_display user %}</a>
       {% endif %}
       <button type="submit" class="btn btn-outline-danger btn-sm">Logout</button>
     </div>
   {% endif %}
 </form>

This is pretty much the allauth template copy&paste and edited into my page.
Again the problem is, that any error will redirect to accounts/login/ or signup or wherever the error occoured. 

Michael Schietzsch

unread,
Dec 4, 2017, 5:57:22 AM12/4/17
to django-allauth
I forgot, you need to add {% load account %} to the top if it
Reply all
Reply to author
Forward
0 new messages