Answer the question
In order to leave comments, you need to log in
How to add a field when registering Django Allauth?
Good afternoon, I have a standard registration on allauth without email, as it is outdated and everyone uses messengers. In my project, Telegram will be the main channel for correspondence with project participants.
How to add a telegram field with certain validations to the registration?
from django.contrib.auth.models import AbstractUser
class UserProfile(AbstractUser):
balance = models.IntegerField(default=0)
telegram = models.CharField(max_length=24,blank=True)
def __unicode__(self):
return self.user.username
<form class="form" method="post" id="signupform">
{% csrf_token %}
{{ form.errors }}
<div class="form-group">
<input type="text" class="form-control form-control-lg" id='id_username' name='username' placeholder="Login" required autofocus>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="password" class="form-control form-control-lg" id='id_password1' name='password1' placeholder="Password" required>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="password" class="form-control form-control-lg" id='id_password2' name='password2' placeholder="Repeat Password" required>
</div>
</div>
</div>
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}">
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question