Reputation: 8528
I'm using django to create database tables,model code like this:
class User(models.Model):
uid = models.CharField(max_length=32,primary_key=True)
nick = models.CharField(max_length=20)
sex = models.CharField(max_length=1,default='M')
sign = models.CharField(max_length=40,default="")
but default value doesn't work.when I show table description,shows that:
why this code doesn't work and how can solve this problem?
Upvotes: 3
Views: 994
Reputation: 268
Django doesn't add default values into the schema, instead it adds the default value if need-be when a User object is created.
Upvotes: 4