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

Split API in each app

This commit is contained in:
Alexandre Iooss 2020-02-18 11:58:42 +01:00
parent 987b898a33
commit 55722b801a
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
13 changed files with 12 additions and 17 deletions

View File

@ -2,7 +2,7 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from activity.models import ActivityType, Activity, Guest
from ..models import ActivityType, Activity, Guest
from rest_framework import serializers
class ActivityTypeSerializer(serializers.ModelSerializer):

View File

@ -4,7 +4,7 @@
from rest_framework import viewsets
from activity.models import ActivityType, Activity, Guest
from ..models import ActivityType, Activity, Guest
from .serializers import ActivityTypeSerializer, ActivitySerializer, GuestSerializer

View File

@ -7,9 +7,9 @@ from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
from rest_framework.authtoken import views as token_views
from .activity.urls import register_activity_urls
from .members.urls import register_members_urls
from .note.urls import register_note_urls
from activity.api.urls import register_activity_urls
from member.api.urls import register_members_urls
from note.api.urls import register_note_urls
class UserSerializer(serializers.ModelSerializer):
@ -34,16 +34,11 @@ class UserViewSet(viewsets.ModelViewSet):
# Routers provide an easy way of automatically determining the URL conf.
# Register each app API router and user viewset
router = routers.DefaultRouter()
router.register('user', UserViewSet)
# Routers for members app
register_members_urls(router, 'members')
# Routers for activity app
register_activity_urls(router, 'activity')
# Routers for note app
register_note_urls(router, 'note')
app_name = 'api'

View File

@ -2,7 +2,7 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from member.models import Profile, Club, Role, Membership
from ..models import Profile, Club, Role, Membership
from rest_framework import serializers

View File

@ -4,7 +4,7 @@
from rest_framework import viewsets
from member.models import Profile, Club, Role, Membership
from ..models import Profile, Club, Role, Membership
from .serializers import ProfileSerializer, ClubSerializer, RoleSerializer, MembershipSerializer

View File

@ -2,8 +2,8 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
from note.models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias
from note.models.transactions import TransactionTemplate, Transaction, MembershipTransaction
from ..models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias
from ..models.transactions import TransactionTemplate, Transaction, MembershipTransaction
from rest_framework import serializers
from rest_polymorphic.serializers import PolymorphicSerializer

View File

@ -5,8 +5,8 @@
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 ..models.notes import Note, NoteClub, NoteSpecial, NoteUser, Alias
from ..models.transactions import TransactionTemplate, Transaction, MembershipTransaction
from .serializers import NoteSerializer, NotePolymorphicSerializer, NoteClubSerializer, NoteSpecialSerializer, \
NoteUserSerializer, AliasSerializer, \
TransactionTemplateSerializer, TransactionSerializer, MembershipTransactionSerializer