Changeset 352:d13220c8831b
- Timestamp:
- 16.05.2011 11:40:54 (12 months ago)
- Branch:
- default
- File:
-
- 1 edited
-
djangobb/djangobb_forum/models.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
djangobb/djangobb_forum/models.py
r323 r352 130 130 class Meta: 131 131 ordering = ['-updated'] 132 get_latest_by = 'updated' 132 133 verbose_name = _('Topic') 133 134 verbose_name_plural = _('Topics') … … 135 136 def __unicode__(self): 136 137 return self.name 138 139 def delete(self, *args, **kwargs): 140 last_post = self.posts.latest() 141 last_post.last_forum_post.clear() 142 forum = self.forum 143 super(Topic, self).delete(*args, **kwargs) 144 try: 145 forum.last_post = Topic.objects.filter(forum__id=forum.id).latest().last_post 146 except Topic.DoesNotExist: 147 forum.last_post = None 148 forum.topic_count = Topic.objects.filter(forum__id=forum.id).count() 149 forum.post_count = Post.objects.filter(topic__forum__id=forum.id).count() 150 forum.save() 137 151 138 152 @property
Note: See TracChangeset
for help on using the changeset viewer.
