Add member counts to /charts/ API

This commit is contained in:
Tanner Collin 2020-04-21 21:12:50 +00:00
parent 20c93cd5c4
commit 9223da6b90
3 changed files with 13 additions and 0 deletions

View File

@ -417,6 +417,12 @@ class MyPasswordChangeSerializer(PasswordChangeSerializer):
super().save()
class MemberCountSerializer(serializers.ModelSerializer):
class Meta:
model = models.StatsMemberCount
fields = '__all__'
class HistoryChangeSerializer(serializers.ModelSerializer):
class Meta:
model = models.HistoryChange

View File

@ -385,6 +385,12 @@ class StatsViewSet(viewsets.ViewSet, List):
raise exceptions.ValidationError(dict(data='This field is required.'))
class MemberCountViewSet(Base, List):
pagination_class = None
queryset = models.StatsMemberCount.objects.all()
serializer_class = serializers.MemberCountSerializer
class BackupView(views.APIView):
def get(self, request):
auth_token = request.META.get('HTTP_AUTHORIZATION', '')

View File

@ -19,6 +19,7 @@ router.register(r'history', views.HistoryViewSet, basename='history')
router.register(r'sessions', views.SessionViewSet, basename='session')
router.register(r'training', views.TrainingViewSet, basename='training')
router.register(r'transactions', views.TransactionViewSet, basename='transaction')
router.register(r'charts/membercount', views.MemberCountViewSet, basename='membercount')
#router.register(r'me', views.FullMemberView, basename='fullmember')
#router.register(r'registration', views.RegistrationViewSet, basename='register')