为什么数据没有存储在数据库中?

时间:2019-12-09 10:13:23

标签: django

我想创建一个相册并将其存储在数据库中,但是抛出错误。以下是创建相册的视图

models.py

    include( __DIR__ . '/includes/countries.php');
    // You have to change the path !

上面歌曲的另一个模型是专辑制作

views.py

class Song_Album_Creation(models.Model):


user = models.ForeignKey(User, default=1 ,on_delete=models.PROTECT)
artist = models.CharField(max_length=250)
album_title = models.CharField(max_length=500)
genre = models.CharField(max_length=100)
album_logo = models.FileField()
album_rating = models.BooleanField()
is_favorite = models.BooleanField(default=False)

def __str__(self):
    return self.album_title

它引发以下错误

  

没有NULL约束失败:music_song_album_creation.album_rating

enter image description here

enter image description here

0 个答案:

没有答案