コード例 #1
0
ファイル: views.py プロジェクト: Soares/natesoares.com
 def entry(self, request, slug, ids):
     ids = ids.rstrip("/").split("/")
     thread = get_object_or_404(self.objects(request), slug=slug)
     getter = partial(self.get_entry, is_staff=request.user.is_staff)
     entry = reduce(getter, ids, thread)
     self.administrate(request, entry)
     next = self.goto(request, thread)
     template = entry.ancestor().entry_template()
     return next or render(request, template, processors=(self.processor, partial(self.entry_processor, entry)))
コード例 #2
0
ファイル: views.py プロジェクト: Soares/natesoares.com
 def thread(self, request, slug=None):
     objects = self.objects(request)
     if slug is None:
         thread = get_object_or_404(objects.all()[:1])
     else:
         thread = get_object_or_404(objects, slug=slug)
     self.administrate(request, thread)
     next = self.goto(request, thread)
     return next or render(
         request, thread.template(), processors=(self.processor, partial(self.thread_processor, thread))
     )