Reformat code, add some missing lines at end of files

This commit is contained in:
Yohann D'ANELLO 2020-02-17 14:08:40 +01:00
parent c884cbb0ad
commit f3f13c5153
6 changed files with 19 additions and 10 deletions

View File

@ -2,9 +2,11 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from rest_framework import viewsets
from activity.models import ActivityType, Activity, Guest
from .serializers import ActivityTypeSerializer, ActivitySerializer, GuestSerializer
from rest_framework import viewsets
class ActivityTypeViewSet(viewsets.ModelViewSet):
"""

View File

@ -2,9 +2,10 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from rest_framework import viewsets
from member.models import Profile, Club, Role, Membership
from .serializers import ProfileSerializer, ClubSerializer, RoleSerializer, MembershipSerializer
from rest_framework import viewsets
class ProfileViewSet(viewsets.ModelViewSet):

View File

@ -2,7 +2,7 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from .views import NoteViewSet, NotePolymorphicViewSet, NoteClubViewSet, NoteUserViewSet, NoteSpecialViewSet, AliasViewSet, \
from .views import NotePolymorphicViewSet, AliasViewSet, \
TransactionViewSet, TransactionTemplateViewSet, MembershipTransactionViewSet

View File

@ -3,11 +3,13 @@
# SPDX-License-Identifier: GPL-3.0-or-later
from django.db.models import Q
from rest_framework import viewsets
from note.models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias
from note.models.transactions import TransactionTemplate, Transaction, MembershipTransaction
from .serializers import NoteSerializer, NotePolymorphicSerializer, NoteClubSerializer, NoteSpecialSerializer, NoteUserSerializer, AliasSerializer, \
from .serializers import NoteSerializer, NotePolymorphicSerializer, NoteClubSerializer, NoteSpecialSerializer, \
NoteUserSerializer, AliasSerializer, \
TransactionTemplateSerializer, TransactionSerializer, MembershipTransactionSerializer
from rest_framework import viewsets
class NoteViewSet(viewsets.ModelViewSet):

View File

@ -10,15 +10,18 @@ from .activity.urls import register_activity_urls
from .members.urls import register_members_urls
from .note.urls import register_note_urls
class UserSerializer(serializers.ModelSerializer):
"""
REST API Serializer for Users.
The djangorestframework plugin will analyse the model `User` and parse all fields in the API.
"""
class Meta:
model = User
exclude = ('password', 'groups', 'user_permissions',)
class UserViewSet(viewsets.ModelViewSet):
"""
REST API View set.
@ -28,6 +31,7 @@ class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all()
serializer_class = UserSerializer
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register('user', UserViewSet)