更新时间:2023-01-30 10:28:44
将可编辑
设置为 False
和默认值
为默认值。
Set editable
to False
and default
to your default value.
http ://docs.djangoproject.com/en/dev/ref/models/fields/#editable
b = models.CharField(max_length=7, default='0000000', editable=False)
您的 id
字段是不必要的。 Django将自动添加。
Also, your id
field is unnecessary. Django will add it automatically.