Ejemplo n.º 1
0
 def get_context_data(self, **kwargs):
     context = super(FeedbacksView, self).get_context_data(**kwargs)
     page = self.request.GET.get('page', None)
     feedbacks = get_paginated_feedbacks(self.request, page=page, per_page=20)
     context['page'] = 'feedbacks'
     context['feedbacks'] = feedbacks
     return context
Ejemplo n.º 2
0
 def get_context_data(self, **kwargs):
     context = super(FlatDetailView, self).get_context_data(**kwargs)
     slug = self.kwargs['slug']
     flat = get_object_or_404(Flat, slug=slug)
     flat_photos = FlatPhoto.objects.filter(flat=flat)
     galery_photos = []
     for flat_photo in flat_photos:
         galery_photos.append({
             "image": flat_photo.image.original.url,
             "thumb": flat_photo.image.version_generate("small").url,
             # "big": flat_photo.image.version_generate("max").url,
             "title": flat_photo.title,
             "description": flat_photo.description
         })
     feedbacks = Feedback.objects.filter(flat=flat, approved=True).order_by('-created_at')[:15]
     context['photos'] = json.dumps(galery_photos)
     context['feedbacks'] = feedbacks
     context['rendered_feedbacks'] = get_paginated_feedbacks(self.request, flat_id=flat.pk)
     context['flat'] = flat
     context['page'] = 'flats'
     if self.request.session.get('has_commented_%s' % flat.pk, False):
         context['has_commented'] = True
     return context