예제 #1
0
 def load_related(self):
     """
     Load related objects using 1 SQL query instead of len(qs) queries
     """
     qs = self.get_queryset()
     return load_content_objects(qs,
                                 cache_field='object',
                                 field='object_id',
                                 ct_field='content_type')
예제 #2
0
파일: views.py 프로젝트: nuSPIC/webapp
def forum_subscription(request):
    """
    Shows forum subscriptions
    """

    profile = request.user.get_profile()
    subscription = load_content_objects(profile.forum_subscription.order_by('-date'))
    subscription_list = paginate(request, subscription, settings.SUBSCRIPTIONS_PER_PAGE)

    return {
        'subscription_list': subscription_list,
    }
예제 #3
0
def forum_subscription(request):
    """
    Shows forum subscriptions
    """

    profile = request.user.profile
    subscription = load_content_objects(
        profile.forum_subscription.order_by('-date'))
    subscription_list = paginate(request, subscription,
                                 settings.SUBSCRIPTIONS_PER_PAGE)

    return {
        'subscription_list': subscription_list,
    }
예제 #4
0
파일: models.py 프로젝트: nuSPIC/webapp
 def load_related(self):
     """
     Load related objects using 1 SQL query instead of len(qs) queries
     """
     qs = self.get_query_set()
     return load_content_objects(qs, cache_field='object', field='object_id', ct_field='content_type')