Esempio n. 1
0
 def get_context_data(self, **kwargs):
     context = super(IdeasDetailView, self).get_context_data(**kwargs)
     context['is_moderator'] = is_moderator(self.request.user,
                                            self.object.location)
     context[
         'title'] = self.object.name + " | " + self.object.location.name + " - Civilhub.org"
     context['location'] = self.object.location
     context['links'] = links['ideas']
     if self.request.user == self.object.creator:
         context['marker_form'] = AjaxPointerForm(
             initial={
                 'content_type': ContentType.objects.get_for_model(
                     self.object),
                 'object_pk': self.object.pk,
             })
     return context
Esempio n. 2
0
 def get_context_data(self, **kwargs):
     news = super(NewsDetailView, self).get_object()
     content_type = ContentType.objects.get_for_model(news)
     context = super(NewsDetailView, self).get_context_data(**kwargs)
     context['is_moderator'] = is_moderator(self.request.user, news.location)
     context['location'] = news.location
     context['content_type'] = content_type.pk
     context['title'] = news.title
     context['map_markers'] = MapPointer.objects.filter(
             content_type = ContentType.objects.get_for_model(self.object)
         ).filter(object_pk=self.object.pk)
     if self.request.user == self.object.creator:
         context['marker_form'] = AjaxPointerForm(initial={
             'content_type': ContentType.objects.get_for_model(self.object),
             'object_pk'   : self.object.pk,
         })
     context['links'] = links['news']
     return context
Esempio n. 3
0
 def get_context_data(self, **kwargs):
     from maps.forms import AjaxPointerForm
     context = super(PollDetails, self).get_context_data(**kwargs)
     context['location'] = self.object.location
     context['title'] = self.object.title
     context['form'] = PollEntryAnswerForm(self.object)
     context['links'] = links['polls']
     context['map_markers'] = MapPointer.objects.filter(
             content_type = ContentType.objects.get_for_model(Poll)
         ).filter(object_pk=self.object.pk)
     if self.request.user == self.object.creator:
         context['marker_form'] = AjaxPointerForm(initial={
             'content_type': ContentType.objects.get_for_model(Poll),
             'object_pk'   : self.object.pk,
         })
     context['can_vote'] = True
     try:
         chk = AnswerSet.objects.filter(user=self.request.user).filter(poll=self.object)
         if len(chk) > 0:
             context['can_vote'] = False
     except:
         context['can_vote'] = False
     return context