Add card scan stats to API
This commit is contained in:
parent
bdbf21f75a
commit
9b98ebf23a
|
@ -433,6 +433,11 @@ class SignupCountSerializer(serializers.ModelSerializer):
|
|||
def get_month(self, obj):
|
||||
return str(obj.month)[:7]
|
||||
|
||||
class SpaceActivitySerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = models.StatsSpaceActivity
|
||||
fields = '__all__'
|
||||
|
||||
|
||||
class HistoryChangeSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
|
|
|
@ -399,6 +399,11 @@ class SignupCountViewSet(Base, List):
|
|||
# have to use method as slicing breaks makemigrations
|
||||
return models.StatsSignupCount.objects.order_by('-month')[:16][::-1]
|
||||
|
||||
class SpaceActivityViewSet(Base, List):
|
||||
pagination_class = None
|
||||
queryset = models.StatsSpaceActivity.objects.all()
|
||||
serializer_class = serializers.SpaceActivitySerializer
|
||||
|
||||
|
||||
class BackupView(views.APIView):
|
||||
def get(self, request):
|
||||
|
|
|
@ -22,6 +22,7 @@ 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'charts/signupcount', views.SignupCountViewSet, basename='signupcount')
|
||||
router.register(r'charts/spaceactivity', views.SpaceActivityViewSet, basename='spaceactivity')
|
||||
#router.register(r'me', views.FullMemberView, basename='fullmember')
|
||||
#router.register(r'registration', views.RegistrationViewSet, basename='register')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user