0
I am studying Jango and trying to set a standard value for a field when makemigrations
is executed, would inform that such field would receive a default value like 0
models.IntegerField(default=0)
It turns out that Preset is defined as None
I don’t understand, the documentation says everything but what I want.
models.IntegerField(default=0)
The default is set to 0 as well.
My model:
class User(models.Model):
# User fields for login
username = models.CharField(max_length=30)
gender = models.IntegerField(default=0)
status = models.IntegerField(default=0)
premium = models.IntegerField(default=0)
ip = models.CharField(max_length=50)
Where default=0
would be the default value for the field
Shows your definition of the models involved, explains better what is happening that you would not like to happen, what is the warging msg or error if there is.
– Sidon
@Sidon edited the post
– user148010
But did not explain the "problem", some error msg? in time: User is already a model of Django, vc can extend it but not in the way you are doing.
– Sidon