Beispiel #1
0
    def get_context_data(self, *args, **kwargs):
        '''
        Add `request.user`-dependent fields, for sharing or subscribing.
        '''
        context = super(Deck, self).get_context_data(*args, **kwargs)
        deck = self.get_object()

        context['owned_by_current_user'] = deck.owner == self.request.user

        # add the review-related data.
        if context['owned_by_current_user']:
            context.update(review_start_context(self.request, deck))
        else:
            context['subscription_url'] = reverse(
                    'rest-deck_subscription', args=[deck.id])

        return context
Beispiel #2
0
    def get_context_data(self, *args, **kwargs):
        '''
        Add `request.user`-dependent fields, for sharing or subscribing.
        '''
        context = super(Deck, self).get_context_data(*args, **kwargs)
        deck = self.get_object()

        context['owned_by_current_user'] = deck.owner == self.request.user

        # add the review-related data.
        if context['owned_by_current_user']:
            context.update(review_start_context(self.request, deck))
        else:
            context['subscription_url'] = reverse('rest-deck_subscription',
                                                  args=[deck.id])

        return context
Beispiel #3
0
 def get(self, request):
     context = review_start_context(self.request)
     context['owned_by_current_user'] = True
     return self.render_to_response(context)
Beispiel #4
0
 def get(self, request):
     context = review_start_context(self.request)
     context['owned_by_current_user'] = True
     return self.render_to_response(context)