P-103
This commit is contained in:
1 parent
4acd1cafda
commit
099f579128
3 files changed
+12
No files matched your search
@@ -47,3 +47,8 @@ class ResultSerializer(serializers.ModelSerializer):
|
|||||||
class VoteResultSerializer(serializers.Serializer):
|
class VoteResultSerializer(serializers.Serializer):
|
||||||
answer = serializers.CharField(source='answer__answer')
|
answer = serializers.CharField(source='answer__answer')
|
||||||
count = serializers.IntegerField()
|
count = serializers.IntegerField()
|
||||||
|
|
||||||
|
class DictEmployeeSerializer(serializers.ModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = DictEmployee
|
||||||
|
fields = '__all__'
|
||||||
@@ -7,4 +7,5 @@ urlpatterns = [
|
|||||||
path('getvotes/', GetVotes.as_view(),name='GetVotes'),
|
path('getvotes/', GetVotes.as_view(),name='GetVotes'),
|
||||||
path('votedetail/<int:id>/', VoteDetail.as_view(),name='VoteDetail'),
|
path('votedetail/<int:id>/', VoteDetail.as_view(),name='VoteDetail'),
|
||||||
path('votecreate/', VoteCreate.as_view(),name='VoteCreate'),
|
path('votecreate/', VoteCreate.as_view(),name='VoteCreate'),
|
||||||
|
path('getdictemployee/', GetDictEmployee.as_view(),name='GetDictEmployee'),
|
||||||
]
|
]
|
||||||
@@ -105,3 +105,9 @@ class VoteCreate(APIView):
|
|||||||
).save()
|
).save()
|
||||||
|
|
||||||
return vote
|
return vote
|
||||||
|
|
||||||
|
class GetDictEmployee(APIView):
|
||||||
|
def get(self, request):
|
||||||
|
employees = DictEmployee.objects.all()
|
||||||
|
employees_serializer = DictEmployeeSerializer(employees, many=True).data
|
||||||
|
return Response(employees_serializer)
|
||||||
Reference in new issue
Block a user