示例#1
0
 def get(self, request):
     if url_get_query_id(request):
         query = get_object_or_404(Query, pk=url_get_query_id(request))
         return self.render_with_sql(request, query)
     if url_get_log_id(request):
         log = get_object_or_404(QueryLog, pk=url_get_log_id(request))
         query = Query(sql=log.sql, title="Playground")
         return self.render_with_sql(request, query)
     return self.render(request)
示例#2
0
 def get(self, request):
     if url_get_query_id(request):
         query = get_object_or_404(Query, pk=url_get_query_id(request))
         return self.render_with_sql(request, query)
     if url_get_log_id(request):
         log = get_object_or_404(QueryLog, pk=url_get_log_id(request))
         query = Query(sql=log.sql, title="Playground")
         return self.render_with_sql(request, query)
     return self.render(request)
示例#3
0
    def get(self, request):
        if url_get_query_id(request):
            query = get_object_or_404(Query, pk=url_get_query_id(request))
            return self.render_with_sql(request, query, run_query=False)

        if url_get_log_id(request):
            log = get_object_or_404(QueryLog, pk=url_get_log_id(request))
            c = log.connection or ''
            query = Query(sql=log.sql, title="Playground", connection=c)
            return self.render_with_sql(request, query)

        return self.render()
示例#4
0
 def get(self, request):
     if not url_get_query_id(request):
         return self.render(request)
     query = get_object_or_404(Query, pk=url_get_query_id(request))
     query.params = url_get_params(request)
     return self.render_with_sql(request, query)
示例#5
0
 def get_queryset(self):
     kwargs = {'sql__isnull': False}
     if url_get_query_id(self.request):
         kwargs['query_id'] = url_get_query_id(self.request)
     return QueryLog.objects.filter(**kwargs).all()
示例#6
0
 def get_queryset(self):
     kwargs = {'sql__isnull': False}
     if url_get_query_id(self.request):
         kwargs['query_id'] = url_get_query_id(self.request)
     return QueryLog.objects.filter(**kwargs).all()
示例#7
0
 def get(self, request):
     if not url_get_query_id(request):
         return self.render(request)
     query = get_object_or_404(Query, pk=url_get_query_id(request))
     query.params = url_get_params(request)
     return self.render_with_sql(request, query)