1π
β
In your create_user
method you write self.model(email, Name, Surname, **other_fields)
, here you pass email
, Name
and Surname
as positional arguments, which is the reason you get an error (basically the email is taken as the id field and the arguments you pass actually go to some other fields or so). Instead pass these as keyword arguments. So your create_user
method would be:
def create_user(self, Email, Name, Surname, Password = None, **other_fields):
# Your other code
user = self.model(Email=email, Name=Name, Surname=Surname, **other_fields)
# Your other code
Note: According to convention variable names in python should be in
snake_case
. So it should be,
etc. See PEP 8 β Style Guide for Python
Code
Source:stackexchange.com