I did this, and here is how;
Here is models.py
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Profile(models.Model):
USER_TYPE_CHOICES = (
('Donor', 'Donor'),
# first is actual value, second is human-readable placeholder
('Seeker', 'Seeker'),
)
BLOOD_GROUP_CHOICES = (
('A+','A+'),
('A-','A-'),
('AB+','AB+'),
('AB-','AB-'),
('B+','B+'),
('B-','B-'),
('O+','O+'),
('O-','O-'),
)
user = models.OneToOneField(User, on_delete=models.CASCADE)
name = models.CharField( max_length=15)
blood_type = models.CharField(max_length=3, choices=BLOOD_GROUP_CHOICES, blank = True, null=True)
user_type = models.CharField(max_length=10, choices=USER_TYPE_CHOICES, null=True, blank=True)
contact_number = models.IntegerField(null=True, blank=True)
def __str__(self):
return str(self.name)
Then I created signals.py in the same app.
from django.dispatch import receiver
from allauth.account.signals import user_signed_up
from .models import Profile
@receiver(user_signed_up)
def create_profile(user, **kwargs):
Profile.objects.create(user=user, name=user.username)
And here is my apps.py;
from django.apps import AppConfig
class DashboardConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'dashboard'
def ready(self):
import dashboard.signals # Import signals module
And it is doing as expected.
Thank you KenWhitesell for guiding me again.