comparison 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
comparison
equal deleted inserted replaced
1205:510ef3cbf3e6 1206:02181fa5ac9d
10 10
11 from smiley.utils import smilify_html 11 from smiley.utils import smilify_html
12 12
13 13
14 class Shout(models.Model): 14 class Shout(models.Model):
15 user = models.ForeignKey(User) 15 user = models.ForeignKey(User, on_delete=models.CASCADE)
16 shout_date = models.DateTimeField(blank=True) 16 shout_date = models.DateTimeField(blank=True)
17 shout = models.TextField() 17 shout = models.TextField()
18 html = models.TextField() 18 html = models.TextField()
19 19
20 class Meta: 20 class Meta:
36 super(Shout, self).save(*args, **kwargs) 36 super(Shout, self).save(*args, **kwargs)
37 37
38 38
39 class ShoutFlag(models.Model): 39 class ShoutFlag(models.Model):
40 """This model represents a user flagging a shout as inappropriate.""" 40 """This model represents a user flagging a shout as inappropriate."""
41 user = models.ForeignKey(User) 41 user = models.ForeignKey(User, on_delete=models.CASCADE)
42 shout = models.ForeignKey(Shout) 42 shout = models.ForeignKey(Shout, on_delete=models.CASCADE)
43 flag_date = models.DateTimeField(auto_now_add=True) 43 flag_date = models.DateTimeField(auto_now_add=True)
44 44
45 def __unicode__(self): 45 def __unicode__(self):
46 return u'Shout ID %s flagged by %s' % (self.shout_id, self.user.username) 46 return u'Shout ID %s flagged by %s' % (self.shout_id, self.user.username)
47 47