Add /stats/ API route with defaults
This commit is contained in:
@@ -16,7 +16,7 @@ import datetime
|
||||
|
||||
import requests
|
||||
|
||||
from . import models, serializers, utils, utils_paypal
|
||||
from . import models, serializers, utils, utils_paypal, utils_stats
|
||||
from .permissions import (
|
||||
is_admin_director,
|
||||
AllowMetadata,
|
||||
@@ -312,6 +312,16 @@ class IpnView(views.APIView):
|
||||
|
||||
|
||||
|
||||
class StatsView(views.APIView):
|
||||
def get(self, request):
|
||||
stats_keys = utils_stats.DEFAULTS.keys()
|
||||
cached_stats = cache.get_many(stats_keys)
|
||||
stats = utils_stats.DEFAULTS.copy()
|
||||
stats.update(cached_stats)
|
||||
return Response(stats)
|
||||
|
||||
|
||||
|
||||
class RegistrationView(RegisterView):
|
||||
serializer_class = serializers.RegistrationSerializer
|
||||
|
||||
|
||||
Reference in New Issue
Block a user