Show More
@@ -281,8 +281,9 b' class Post(models.Model):' | |||||
281 |
|
281 | |||
282 | replies = models.ManyToManyField('Post', symmetrical=False, null=True, |
|
282 | replies = models.ManyToManyField('Post', symmetrical=False, null=True, | |
283 | blank=True, related_name='re+') |
|
283 | blank=True, related_name='re+') | |
284 |
referenced_posts = models.ManyToManyField('Post', symmetrical=False, |
|
284 | referenced_posts = models.ManyToManyField('Post', symmetrical=False, | |
285 |
|
|
285 | null=True, | |
|
286 | blank=True, related_name='rfp+') | |||
286 |
|
287 | |||
287 | def __unicode__(self): |
|
288 | def __unicode__(self): | |
288 | return '#' + str(self.id) + ' ' + self.title + ' (' + \ |
|
289 | return '#' + str(self.id) + ' ' + self.title + ' (' + \ | |
@@ -317,7 +318,6 b' class Post(models.Model):' | |||||
317 | if self.can_bump(): |
|
318 | if self.can_bump(): | |
318 | self.bump_time = timezone.now() |
|
319 | self.bump_time = timezone.now() | |
319 |
|
320 | |||
320 |
|
||||
321 | def get_last_replies(self): |
|
321 | def get_last_replies(self): | |
322 | if settings.LAST_REPLIES_COUNT > 0: |
|
322 | if settings.LAST_REPLIES_COUNT > 0: | |
323 | reply_count = self.get_reply_count() |
|
323 | reply_count = self.get_reply_count() | |
@@ -325,8 +325,8 b' class Post(models.Model):' | |||||
325 | if reply_count > 0: |
|
325 | if reply_count > 0: | |
326 | reply_count_to_show = min(settings.LAST_REPLIES_COUNT, |
|
326 | reply_count_to_show = min(settings.LAST_REPLIES_COUNT, | |
327 | reply_count) |
|
327 | reply_count) | |
328 |
last_replies = self.replies.all().order_by('pub_time')[ |
|
328 | last_replies = self.replies.all().order_by('pub_time')[ | |
329 |
|
|
329 | reply_count - reply_count_to_show:] | |
330 |
|
330 | |||
331 | return last_replies |
|
331 | return last_replies | |
332 |
|
332 | |||
@@ -336,7 +336,7 b' class Post(models.Model):' | |||||
336 | return self.tags.order_by('name') |
|
336 | return self.tags.order_by('name') | |
337 |
|
337 | |||
338 | def get_cache_key(self): |
|
338 | def get_cache_key(self): | |
339 | return str(self.id) + str(self.last_edit_time) |
|
339 | return str(self.id) + str(self.last_edit_time.microsecond) | |
340 |
|
340 | |||
341 |
|
341 | |||
342 | class User(models.Model): |
|
342 | class User(models.Model): |
General Comments 0
You need to be logged in to leave comments.
Login now