Skip to content

Commit ccda2bb

Browse files
anezkamllekohl
authored andcommitted
Added 'on_delete' to 'ForeignKey' in Django models
It caused error when deploying to PythonAnywhere
1 parent ccbbe64 commit ccda2bb

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cs/django_models/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ from django.utils import timezone
115115

116116

117117
class Post(models.Model):
118-
author = models.ForeignKey('auth.User')
118+
author = models.ForeignKey('auth.User',on_delete=models.CASCADE)
119119
title = models.CharField(max_length=200)
120120
text = models.TextField()
121121
created_date = models.DateTimeField(

0 commit comments

Comments
 (0)