comparison forums/models.py @ 1028:5ba2508939f7

Django 1.8 changes; first batch.
author Brian Neal <bgneal@gmail.com>
date Tue, 15 Dec 2015 21:01:07 -0600
parents 4619290d171d
children eeaf387803c6
comparison
equal deleted inserted replaced
1027:cd4db27c90e3 1028:5ba2508939f7
17 Forums belong to a category, whose access may be assigned to groups. 17 Forums belong to a category, whose access may be assigned to groups.
18 """ 18 """
19 name = models.CharField(max_length=80) 19 name = models.CharField(max_length=80)
20 slug = models.SlugField(max_length=80) 20 slug = models.SlugField(max_length=80)
21 position = models.IntegerField(blank=True, default=0) 21 position = models.IntegerField(blank=True, default=0)
22 groups = models.ManyToManyField(Group, blank=True, null=True, 22 groups = models.ManyToManyField(Group, blank=True,
23 help_text="If groups are assigned to this category, only members" \ 23 help_text="If groups are assigned to this category, only members" \
24 " of those groups can view this category.") 24 " of those groups can view this category.")
25 25
26 class Meta: 26 class Meta:
27 ordering = ('position', ) 27 ordering = ('position', )
84 category = models.ForeignKey(Category, related_name='forums') 84 category = models.ForeignKey(Category, related_name='forums')
85 name = models.CharField(max_length=80) 85 name = models.CharField(max_length=80)
86 slug = models.SlugField(max_length=80) 86 slug = models.SlugField(max_length=80)
87 description = models.TextField(blank=True, default='') 87 description = models.TextField(blank=True, default='')
88 position = models.IntegerField(blank=True, default=0) 88 position = models.IntegerField(blank=True, default=0)
89 moderators = models.ManyToManyField(Group, blank=True, null=True) 89 moderators = models.ManyToManyField(Group, blank=True)
90 90
91 # denormalized fields to reduce database hits 91 # denormalized fields to reduce database hits
92 topic_count = models.IntegerField(blank=True, default=0) 92 topic_count = models.IntegerField(blank=True, default=0)
93 post_count = models.IntegerField(blank=True, default=0) 93 post_count = models.IntegerField(blank=True, default=0)
94 last_post = models.OneToOneField('Post', blank=True, null=True, 94 last_post = models.OneToOneField('Post', blank=True, null=True,
282 user = models.ForeignKey(User, related_name='posts') 282 user = models.ForeignKey(User, related_name='posts')
283 creation_date = models.DateTimeField(db_index=True) 283 creation_date = models.DateTimeField(db_index=True)
284 update_date = models.DateTimeField(db_index=True) 284 update_date = models.DateTimeField(db_index=True)
285 body = models.TextField() 285 body = models.TextField()
286 html = models.TextField() 286 html = models.TextField()
287 user_ip = models.IPAddressField(blank=True, default='', null=True) 287 user_ip = models.GenericIPAddressField(blank=True, default='', null=True)
288 attachments = models.ManyToManyField(Oembed, through='Attachment') 288 attachments = models.ManyToManyField(Oembed, through='Attachment')
289 289
290 class Meta: 290 class Meta:
291 ordering = ('creation_date', ) 291 ordering = ('creation_date', )
292 get_latest_by = 'creation_date' 292 get_latest_by = 'creation_date'