コード例 #1
0
ファイル: models.py プロジェクト: imclab/chieftain
 def count(self, limit=5):
     """Returns dict, that contains info about thread files and posts."""
     ps = self.posts()
     total = ps.count()
     if total <= limit:
         return {"total": total, "skipped": 0, "skipped_files": 0}
     start = total - limit
     skipped_ids = tools.take_first(ps[1:start].values_list("id"))
     return {
         "total": total,
         "start": start,
         "stop": total,
         "skipped": start - 1,
         "skipped_files": ps.filter(id__in=skipped_ids, file=True).count()
     }
コード例 #2
0
ファイル: models.py プロジェクト: mikotohime/chieftain
 def count(self, limit=5):
     """Returns dict, that contains info about thread files and posts."""
     ps = self.posts()
     total = ps.count()
     if total <= limit:
         return {"total": total, "skipped": 0, "skipped_files": 0}
     start = total - limit
     skipped_ids = tools.take_first(ps[1:start].values_list("id"))
     return {
         "total": total,
         "start": start,
         "stop": total,
         "skipped": start - 1,
         "skipped_files": ps.filter(id__in=skipped_ids, file=True).count()
     }
コード例 #3
0
ファイル: models.py プロジェクト: imclab/chieftain
 def modded(self):
     """List of modded section slugs."""
     return tools.take_first(self.sections.values_list("slug"))
コード例 #4
0
ファイル: models.py プロジェクト: imclab/chieftain
 def words(self):
     return tools.take_first(self.values_list("word"))
コード例 #5
0
ファイル: models.py プロジェクト: mikotohime/chieftain
 def modded(self):
     """List of modded section slugs."""
     return tools.take_first(self.sections.values_list("slug"))
コード例 #6
0
ファイル: models.py プロジェクト: mikotohime/chieftain
 def words(self):
     return tools.take_first(self.values_list("word"))