예제 #1
0
 def get_queryset(self):
     if app_settings.EXPLORER_PERMISSION_VIEW(self.request.user):
         qs = Query.objects.prefetch_related('created_by_user').all()
     else:
         qs = Query.objects.prefetch_related('created_by_user').filter(
             pk__in=allowed_query_pks(self.request.user.id))
     return qs.annotate(run_count=Count('querylog'))
예제 #2
0
 def get_queryset(self):
     if app_settings.EXPLORER_PERMISSION_VIEW(self.request.user):
         qs = (Query.objects.prefetch_related('created_by_user',
                                              'querylog_set').all())
     else:
         qs = (Query.objects.prefetch_related(
             'created_by_user', 'querylog_set').filter(
                 pk__in=allowed_query_pks(self.request.user.id)))
     return qs
예제 #3
0
 def wrap(request, *args, **kwargs):
     if not app_settings.EXPLORER_PERMISSION_VIEW(request.user)\
             and not allowed_query_pks(request.user.id):
         return safe_admin_login_prompt(request)
     return f(request, *args, **kwargs)
 def wrap(request, *args, **kwargs):
     if not app_settings.EXPLORER_PERMISSION_VIEW(request.user)\
             and not allowed_query_pks(request.user.id):
         return safe_admin_login_prompt(request)
     return f(request, *args, **kwargs)
 def get_queryset(self):
     if app_settings.EXPLORER_PERMISSION_VIEW(self.request.user):
         qs = Query.objects.prefetch_related('created_by_user').all()
     else:
         qs = Query.objects.prefetch_related('created_by_user').filter(pk__in=allowed_query_pks(self.request.user.id))
     return qs.annotate(run_count=Count('querylog'))
예제 #6
0
 def get_queryset(self):
     if app_settings.EXPLORER_PERMISSION_VIEW(self.request.user):
         return Query.objects.prefetch_related('created_by_user').all()
     else:
         return Query.objects.prefetch_related('created_by_user').filter(pk__in=allowed_query_pks(self.request.user.id))
예제 #7
0
def view_permission_list(request):
    return app_settings.EXPLORER_PERMISSION_VIEW(request.user)\
        or allowed_query_pks(request.user.id)
예제 #8
0
def view_permission_list(request):
    return app_settings.EXPLORER_PERMISSION_VIEW(request.user)\
        or allowed_query_pks(request.user.id)