Skip to content

Commit

Permalink
Add on_delete to test models
Browse files Browse the repository at this point in the history
This should increase compatiblity with Django 2.0
  • Loading branch information
jwhitlock committed Apr 5, 2017
1 parent 33a081a commit 501ab0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion testapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='choice',
name='question',
field=models.ForeignKey(to='testapp.Question'),
field=models.ForeignKey(to='testapp.Question', on_delete=models.CASCADE),
preserve_default=True,
),
]
2 changes: 1 addition & 1 deletion testapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __str__(self):
class Choice(models.Model):
"""A poll answer."""

question = models.ForeignKey(Question)
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)

Expand Down

0 comments on commit 501ab0e

Please sign in to comment.