Add simple view to give OAuth information
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
76d1784aea
commit
b244e01231
2 changed files with 19 additions and 0 deletions
17
apps/api/views.py
Normal file
17
apps/api/views.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Copyright (C) 2018-2021 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from rest_framework.generics import RetrieveAPIView
|
||||
|
||||
from .serializers import UserSerializer
|
||||
|
||||
|
||||
class UserInformationView(RetrieveAPIView):
|
||||
serializer_class = UserSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
return User.objects.filter(pk=self.request.user.pk)
|
||||
|
||||
def get_object(self):
|
||||
return self.request.user
|
||||
Loading…
Add table
Add a link
Reference in a new issue