我有像下面的django模型
class Artist(models.Model):
user = models.ForeignKey(user_model(), related_name="user")
name = models.CharField(max_length=75)
surname = models.CharField(max_length=75)
category = models.ManyToManyField(Category, null=True, blank=True)
city = models.ForeignKey(City, null=True, blank=True)
interest = models.ManyToManyField(Interest, null=True, blank=True)
biography = models.TextField(max_length=500, null=True, blank=True)
image = models.ImageField(upload_to="media/profile_photos/", null=True, blank=True)
email = models.EmailField(null=True, blank=True)
followers = models.ManyToManyField(user_model(),null=True, blank=True,
related_name="follower")
我正在使用模型表单 但是当我尝试保存表单而没有给出兴趣和城市值时,我在调试器中得到以下错误。我重新创建了数据库并且仍然是相同的。任何想法??
ipdb> self.errors
{'city': [u'This field is required.'], 'interest': [u'"" is not a valid value for a primary key.']}