Ejemplo n.º 1
0
    def get_context_data(self, **kwargs):
        context = super(PoemDetailView, self).get_context_data(**kwargs)
        poem = Poem.objects.get(id=self.kwargs['pk'])
        context.update({
        'poem': poem,
        'vote_form': AddVoteForm,
        'already_voted_for_poem': already_voted_for_object(self.request, poem),
        'issue_form': IssueReportForm,
        })

        return context
Ejemplo n.º 2
0
 def get_context_data(self, *args, **kwargs):
     context = super(LiteratureDetailView, self).get_context_data(**kwargs)
     ct = ContentType.objects.get_for_model(self.object)
     if not self.request.GET.get("chapter"):
         try:
             context["chapter"] = Chapter.objects.filter(content_type=ct, object_id=self.object.pk).first()
         except:
             raise Http404
     else:
         try:
             context["chapter"] = Chapter.objects.get(id=self.request.GET.get("chapter"))
         except:
             raise Http404
     chapters = Chapter.objects.filter(content_type=ct, object_id=self.object.pk).order_by("id")
     context["chapter_list"] = chapters
     context["already_voted_for_object"] = already_voted_for_object(self.request, self.object)
     context["issue_form"] = IssueReportForm
     return context
Ejemplo n.º 3
0
 def get_context_data(self, *args, **kwargs):
     context = super(FanfictionDetailView, self).get_context_data(**kwargs)
     ct = ContentType.objects.get_for_model(self.object)
     if not self.request.GET.get('chapter'):
         try:
             context['chapter'] = Chapter.objects.filter(content_type=ct, object_id=self.object.pk).first()
         except:
             raise Http404
     else:
         try:
             context['chapter'] = Chapter.objects.get(id=self.request.GET.get('chapter'))
         except:
             raise Http404
     chapters = Chapter.objects.filter(content_type=ct, object_id=self.object.pk).order_by('id')
     context['chapter_list'] = chapters
     context['already_voted_for_object'] = already_voted_for_object(self.request, self.object)
     context['issue_form'] = IssueReportForm
     return context