Frequently Asked Questions dealing with a
Error message: myapp.Article.tags: (fields.W340) null has ManyToManyField ON NO Effect.
Solution: tags = models.ManyToManyField ( "Tag") with not null
FAQ treated titanium
报错信息:ERRORS:
myapp.Tag.date: (fields.E130) DecimalFields must define a 'decimal_places' attribute.
myapp.Tag.date: (fields.E132) DecimalFields must define a 'max_digits' attribute.
Solution: "decimal_places (there are several decimal places) and" DecimalFields field max_digits (total number of digits). "
class the Account (models.Model): "" " Account table " "" username = models.CharField (= 64 MAX_LENGTH, UNIQUE = True) password = models.CharField (MAX_LENGTH = 255 ) In Email = models.EmailField (UNIQUE = True) register_date = models.DateTimeField (auto_now_add = True) # Member auto_now_add the current time, it can not be overridden signature = models.CharField ( " signature " , max_length = 255, null = True) class Article This article was (models.Model): "" " article table "" " title = Models.CharField(max_length=255,unique=True) context = models.TextField() account = models.ForeignKey("Account",on_delete=models.CASCADE) # models.CASCADE 当用户删除时,文章也删除 tags = models.ManyToManyField("Tag") pub_date = models.DateTimeField() class Tag(models.Model): "标签表" name = models.CharField(max_length=64,unique=True) date = models.DateTimeField(auto_now_add=True)