comparison weblinks/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
30 is_public=True).select_related() 30 is_public=True).select_related()
31 31
32 32
33 class LinkBase(models.Model): 33 class LinkBase(models.Model):
34 """Abstract model to aggregate common fields of a web link.""" 34 """Abstract model to aggregate common fields of a web link."""
35 category = models.ForeignKey(Category) 35 category = models.ForeignKey(Category, on_delete=models.CASCADE)
36 title = models.CharField(max_length=128) 36 title = models.CharField(max_length=128)
37 url = models.URLField(db_index=True) 37 url = models.URLField(db_index=True)
38 description = models.TextField(blank=True) 38 description = models.TextField(blank=True)
39 user = models.ForeignKey(User) 39 user = models.ForeignKey(User, on_delete=models.CASCADE)
40 date_added = models.DateTimeField(db_index=True) 40 date_added = models.DateTimeField(db_index=True)
41 update_date = models.DateTimeField(db_index=True, blank=True) 41 update_date = models.DateTimeField(db_index=True, blank=True)
42 42
43 class Meta: 43 class Meta:
44 abstract = True 44 abstract = True
106 flagged_link.save() 106 flagged_link.save()
107 107
108 108
109 class FlaggedLink(models.Model): 109 class FlaggedLink(models.Model):
110 """Model to represent links that have been flagged as broken by users""" 110 """Model to represent links that have been flagged as broken by users"""
111 link = models.ForeignKey(Link) 111 link = models.ForeignKey(Link, on_delete=models.CASCADE)
112 user = models.ForeignKey(User) 112 user = models.ForeignKey(User, on_delete=models.CASCADE)
113 date_flagged = models.DateField(auto_now_add = True) 113 date_flagged = models.DateField(auto_now_add = True)
114 approved = models.BooleanField(default = False, 114 approved = models.BooleanField(default = False,
115 help_text = 'Check this and save to remove the referenced link from the database') 115 help_text = 'Check this and save to remove the referenced link from the database')
116 116
117 objects = FlaggedLinkManager() 117 objects = FlaggedLinkManager()