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 # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from rest_framework import viewsets
from activity.models import ActivityType, Activity, Guest from activity.models import ActivityType, Activity, Guest
from .serializers import ActivityTypeSerializer, ActivitySerializer, GuestSerializer from .serializers import ActivityTypeSerializer, ActivitySerializer, GuestSerializer
from rest_framework import viewsets
class ActivityTypeViewSet(viewsets.ModelViewSet): class ActivityTypeViewSet(viewsets.ModelViewSet):
""" """

View File

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

View File

@ -2,8 +2,8 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # 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 TransactionViewSet, TransactionTemplateViewSet, MembershipTransactionViewSet
def register_note_urls(router, path): def register_note_urls(router, path):

View File

@ -3,11 +3,13 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from django.db.models import Q from django.db.models import Q
from rest_framework import viewsets
from note.models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias from note.models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias
from note.models.transactions import TransactionTemplate, Transaction, MembershipTransaction from note.models.transactions import TransactionTemplate, Transaction, MembershipTransaction
from .serializers import NoteSerializer, NotePolymorphicSerializer, NoteClubSerializer, NoteSpecialSerializer, NoteUserSerializer, AliasSerializer, \ from .serializers import NoteSerializer, NotePolymorphicSerializer, NoteClubSerializer, NoteSpecialSerializer, \
TransactionTemplateSerializer, TransactionSerializer, MembershipTransactionSerializer NoteUserSerializer, AliasSerializer, \
from rest_framework import viewsets TransactionTemplateSerializer, TransactionSerializer, MembershipTransactionSerializer
class NoteViewSet(viewsets.ModelViewSet): 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 .members.urls import register_members_urls
from .note.urls import register_note_urls from .note.urls import register_note_urls
class UserSerializer(serializers.ModelSerializer): class UserSerializer(serializers.ModelSerializer):
""" """
REST API Serializer for Users. REST API Serializer for Users.
The djangorestframework plugin will analyse the model `User` and parse all fields in the API. The djangorestframework plugin will analyse the model `User` and parse all fields in the API.
""" """
class Meta: class Meta:
model = User model = User
exclude = ('password', 'groups', 'user_permissions',) exclude = ('password', 'groups', 'user_permissions',)
class UserViewSet(viewsets.ModelViewSet): class UserViewSet(viewsets.ModelViewSet):
""" """
REST API View set. REST API View set.
@ -28,6 +31,7 @@ class UserViewSet(viewsets.ModelViewSet):
queryset = User.objects.all() queryset = User.objects.all()
serializer_class = UserSerializer serializer_class = UserSerializer
# Routers provide an easy way of automatically determining the URL conf. # Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter() router = routers.DefaultRouter()
router.register('user', UserViewSet) router.register('user', UserViewSet)