Mercurial > public > sg101
diff potd/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/potd/models.py Sat Jan 04 21:34:31 2025 -0600 +++ b/potd/models.py Wed Jan 22 17:58:16 2025 -0600 @@ -33,7 +33,8 @@ thumb = models.ImageField(upload_to='potd/%Y/%m/%d/thumbs', blank=True, null=True) caption = models.CharField(max_length=128) description = models.TextField() - user = models.ForeignKey(User, related_name='potd_set') + user = models.ForeignKey(User, related_name='potd_set', + on_delete=models.CASCADE) date_added = models.DateField() potd_count = models.IntegerField(default=0) @@ -115,7 +116,7 @@ class Current(models.Model): """This model simply stores the current POTD.""" - potd = models.ForeignKey(Photo) + potd = models.ForeignKey(Photo, on_delete=models.CASCADE) objects = CurrentManager()