1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-22 02:18:21 +02: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

@ -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'))
]
]