Fix ingredient model (#1258)

Add the required positional argument: 'on_delete'
This commit is contained in:
Chouaib Lammas 2021-12-10 09:51:10 +00:00 committed by GitHub
parent 1e4b03b975
commit ef9d67302e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,7 +70,7 @@ Let's get started with these models:
class Ingredient(models.Model): class Ingredient(models.Model):
name = models.CharField(max_length=100) name = models.CharField(max_length=100)
notes = models.TextField() notes = models.TextField()
category = models.ForeignKey(Category, related_name='ingredients') category = models.ForeignKey(Category, related_name='ingredients', on_delete=models.CASCADE)
def __str__(self): def __str__(self):
return self.name return self.name