From 571c9ae48cf51a99cd46e540d944db3ed06efd3b Mon Sep 17 00:00:00 2001 From: rashfael Date: Thu, 28 Jun 2018 20:22:25 +0200 Subject: [PATCH] unfuck tests --- server/eventomat/event/serialisers.py | 7 +++++++ server/eventomat/event/views.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server/eventomat/event/serialisers.py b/server/eventomat/event/serialisers.py index 4057022..273f383 100644 --- a/server/eventomat/event/serialisers.py +++ b/server/eventomat/event/serialisers.py @@ -11,6 +11,13 @@ class UserSerialiser(serializers.ModelSerializer): + class Meta: + model = User + fields = ('id', 'username') + + +class OwnUserSerialiser(serializers.ModelSerializer): + class Meta: model = User fields = ('id', 'username', 'is_staff') diff --git a/server/eventomat/event/views.py b/server/eventomat/event/views.py index 511de82..dac35f7 100644 --- a/server/eventomat/event/views.py +++ b/server/eventomat/event/views.py @@ -10,8 +10,8 @@ from .models import Attendance, Event, Room, Series from .permissions import KeyholderPermission from .serialisers import ( - EventEditSerialiser, EventListSerialiser, RoomSerialiser, - SeriesEditSerialiser, SeriesListSerialiser, UserSerialiser, + EventEditSerialiser, EventListSerialiser, OwnUserSerialiser, + RoomSerialiser, SeriesEditSerialiser, SeriesListSerialiser, ) @@ -89,5 +89,5 @@ def perform_destroy(self, instance): class OwnUser(APIView): def get(self, request): - serializer = UserSerialiser(request.user) + serializer = OwnUserSerialiser(request.user) return Response(serializer.data)