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)
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()
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)
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()