##// END OF EJS Templates
Fixed some issues based on feedback at linux.org.ru
neko259 -
r618:60f60d98 default
parent child Browse files
Show More
@@ -241,7 +241,7 b' class Post(models.Model):'
241
241
242 def get_title(self):
242 def get_title(self):
243 title = self.title
243 title = self.title
244 if len(title) == 0:
244 if not title:
245 title = self.text.rendered
245 title = self.text.rendered
246
246
247 return title
247 return title
@@ -250,7 +250,7 b' class Post(models.Model):'
250 return self.referenced_posts.order_by('id')
250 return self.referenced_posts.order_by('id')
251
251
252 def is_referenced(self):
252 def is_referenced(self):
253 return self.referenced_posts.all().exists()
253 return self.referenced_posts.exists()
254
254
255 def is_opening(self):
255 def is_opening(self):
256 return self.thread_new.get_opening_post() == self
256 return self.thread_new.get_opening_post() == self
@@ -369,7 +369,7 b' class Thread(models.Model):'
369 Completely delete thread and all its posts
369 Completely delete thread and all its posts
370 """
370 """
371
371
372 if self.replies.count() > 0:
372 if self.replies.exists():
373 self.replies.all().delete()
373 self.replies.all().delete()
374
374
375 self.delete()
375 self.delete()
@@ -385,7 +385,7 b' class Thread(models.Model):'
385 if reply_count > 0:
385 if reply_count > 0:
386 reply_count_to_show = min(settings.LAST_REPLIES_COUNT,
386 reply_count_to_show = min(settings.LAST_REPLIES_COUNT,
387 reply_count - 1)
387 reply_count - 1)
388 last_replies = self.replies.all().order_by(
388 last_replies = self.replies.order_by(
389 'pub_time')[reply_count - reply_count_to_show:]
389 'pub_time')[reply_count - reply_count_to_show:]
390
390
391 return last_replies
391 return last_replies
General Comments 0
You need to be logged in to leave comments. Login now