2020-12-07 16:06:14 +01:00
|
|
|
import json
|
|
|
|
|
2021-08-23 12:17:12 +02:00
|
|
|
from rest_framework import mixins, viewsets
|
2020-12-07 16:06:14 +01:00
|
|
|
from rest_framework.response import Response
|
|
|
|
|
2021-02-03 10:22:42 +01:00
|
|
|
from posthog.utils import get_safe_cache
|
2020-12-07 16:06:14 +01:00
|
|
|
|
|
|
|
|
2021-08-23 12:17:12 +02:00
|
|
|
class DebugCHQueries(mixins.ListModelMixin, viewsets.GenericViewSet):
|
2020-12-07 16:06:14 +01:00
|
|
|
"""
|
|
|
|
Show recent queries for this user
|
|
|
|
"""
|
|
|
|
|
|
|
|
def list(self, request):
|
2021-02-03 10:22:42 +01:00
|
|
|
return Response(json.loads(get_safe_cache("save_query_{}".format(request.user.pk)) or "[]"))
|