Mercurial > public > sg101
diff shoutbox/models.py @ 1206:02181fa5ac9d modernize tip
Update to Django 1.9.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 22 Jan 2025 17:58:16 -0600 |
parents | eeaf387803c6 |
children |
line wrap: on
line diff
--- a/shoutbox/models.py Sat Jan 04 21:34:31 2025 -0600 +++ b/shoutbox/models.py Wed Jan 22 17:58:16 2025 -0600 @@ -12,7 +12,7 @@ class Shout(models.Model): - user = models.ForeignKey(User) + user = models.ForeignKey(User, on_delete=models.CASCADE) shout_date = models.DateTimeField(blank=True) shout = models.TextField() html = models.TextField() @@ -38,8 +38,8 @@ class ShoutFlag(models.Model): """This model represents a user flagging a shout as inappropriate.""" - user = models.ForeignKey(User) - shout = models.ForeignKey(Shout) + user = models.ForeignKey(User, on_delete=models.CASCADE) + shout = models.ForeignKey(Shout, on_delete=models.CASCADE) flag_date = models.DateTimeField(auto_now_add=True) def __unicode__(self):