1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-27 18:02:23 +00:00

autofocus of signup form on first field

This commit is contained in:
Pierre-antoine Comby 2020-02-25 22:26:43 +01:00
parent 25fc35c857
commit eb6f142bf8
2 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,11 @@ from crispy_forms.layout import Layout
class SignUpForm(UserCreationForm):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.fields['username'].widget.attrs.pop("autofocus", None)
self.fields['first_name'].widget.attrs.update({"autofocus":"autofocus"})
class Meta:
model = User
fields = ['first_name', 'last_name', 'username', 'email']

View File

@ -10,7 +10,7 @@
{% csrf_token %}
{{ form|crispy }}
{{ profile_form|crispy }}
<button class="btn btn-link" type="submit">
<button class="btn btn-success" type="submit">
{% trans "Sign Up" %}
</button>
</form>