1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-22 23:42:25 +00:00

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):
"""
@ -33,4 +35,4 @@ class GuestViewSet(viewsets.ModelViewSet):
then render it on /api/activity/guest/
"""
queryset = Guest.objects.all()
serializer_class = GuestSerializer
serializer_class = GuestSerializer

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,8 +2,8 @@
# 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, \
TransactionViewSet, TransactionTemplateViewSet, MembershipTransactionViewSet
from .views import NotePolymorphicViewSet, AliasViewSet, \
TransactionViewSet, TransactionTemplateViewSet, MembershipTransactionViewSet
def register_note_urls(router, path):

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, \
TransactionTemplateSerializer, TransactionSerializer, MembershipTransactionSerializer
from rest_framework import viewsets
from .serializers import NoteSerializer, NotePolymorphicSerializer, NoteClubSerializer, NoteSpecialSerializer, \
NoteUserSerializer, AliasSerializer, \
TransactionTemplateSerializer, TransactionSerializer, MembershipTransactionSerializer
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)
@ -46,4 +50,4 @@ register_note_urls(router, 'note')
urlpatterns = [
url('^', include(router.urls)),
url('^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
]

View File

@ -23,4 +23,4 @@ requests==2.22.0
requests-oauthlib==1.2.0
six==1.12.0
sqlparse==0.3.0
urllib3==1.25.3
urllib3==1.25.3