I have a Profile
model that extends the user model like so,
class Profile(User):
user = models.OneToOneField(User, parent_link=True, on_delete=models.CASCADE)
slug = models.SlugField(unique=True, blank=True)
def save(self, *args, **kwargs):
print('self.username')
print(self.username)
self.slug = self.username
super(Profile, self).save(*args, **kwargs)
I am trying to create a slug field for my model , so I override the save method to include the slug as the username. The thing is, when I create a new user with the command createsuperuser
and print out the username as you can see in the code, it doesn't show anything - it doesn't show the provided username. Could this be the reason why I am having this problem ? And if so, how can I fix it?