Add member counts to /charts/ API
This commit is contained in:
parent
20c93cd5c4
commit
9223da6b90
|
@ -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
|
||||
|
|
|
@ -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', '')
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user