mirror of https://github.com/snachodog/mybuddy.git
Remove example User model API.
This commit is contained in:
parent
eaabcc6faf
commit
2452826586
|
@ -1,7 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.models import Baby, DiaperChange, Feeding, Sleep, TummyTime
|
from core.models import Baby, DiaperChange, Feeding, Sleep, TummyTime
|
||||||
|
@ -35,9 +34,3 @@ class TummyTimeSerializer(serializers.HyperlinkedModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = TummyTime
|
model = TummyTime
|
||||||
fields = ('baby', 'start', 'end', 'duration', 'milestone')
|
fields = ('baby', 'start', 'end', 'duration', 'milestone')
|
||||||
|
|
||||||
|
|
||||||
class UserSerializer(serializers.HyperlinkedModelSerializer):
|
|
||||||
class Meta:
|
|
||||||
model = User
|
|
||||||
fields = ('url', 'username', 'email', 'is_staff')
|
|
||||||
|
|
|
@ -2,19 +2,15 @@ from django.conf.urls import url, include
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
|
||||||
from .views import (BabyViewSet, DiaperChangeViewSet, FeedingViewSet,
|
from .views import (BabyViewSet, DiaperChangeViewSet, FeedingViewSet,
|
||||||
SleepViewSet, TummyTimeViewSet, UserViewSet)
|
SleepViewSet, TummyTimeViewSet)
|
||||||
|
|
||||||
# Routers provide an easy way of automatically determining the URL conf.
|
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
router.register(r'babies', BabyViewSet)
|
router.register(r'babies', BabyViewSet)
|
||||||
router.register(r'diaper-changes', DiaperChangeViewSet)
|
router.register(r'diaper-changes', DiaperChangeViewSet)
|
||||||
router.register(r'feedings', FeedingViewSet)
|
router.register(r'feedings', FeedingViewSet)
|
||||||
router.register(r'sleep', SleepViewSet)
|
router.register(r'sleep', SleepViewSet)
|
||||||
router.register(r'tummy-times', TummyTimeViewSet)
|
router.register(r'tummy-times', TummyTimeViewSet)
|
||||||
router.register(r'users', UserViewSet)
|
|
||||||
|
|
||||||
# Wire up our API using automatic URL routing.
|
|
||||||
# Additionally, we include login URLs for the browsable API.
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^api/', include(router.urls)),
|
url(r'^api/', include(router.urls)),
|
||||||
url(r'^api-auth/', include('rest_framework.urls',
|
url(r'^api-auth/', include('rest_framework.urls',
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
|
||||||
from rest_framework import viewsets
|
from rest_framework import viewsets
|
||||||
|
|
||||||
from core.models import Baby, DiaperChange, Feeding, Sleep, TummyTime
|
from core.models import Baby, DiaperChange, Feeding, Sleep, TummyTime
|
||||||
from .serializers import (BabySerializer, DiaperChangeSerializer,
|
from .serializers import (BabySerializer, DiaperChangeSerializer,
|
||||||
FeedingSerializer, SleepSerializer,
|
FeedingSerializer, SleepSerializer,
|
||||||
TummyTimeSerializer, UserSerializer,)
|
TummyTimeSerializer,)
|
||||||
|
|
||||||
|
|
||||||
class BabyViewSet(viewsets.ModelViewSet):
|
class BabyViewSet(viewsets.ModelViewSet):
|
||||||
|
@ -83,8 +82,3 @@ class TummyTimeViewSet(viewsets.ModelViewSet):
|
||||||
queryset = queryset.filter(**{param: value})
|
queryset = queryset.filter(**{param: value})
|
||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
class UserViewSet(viewsets.ModelViewSet):
|
|
||||||
queryset = User.objects.all()
|
|
||||||
serializer_class = UserSerializer
|
|
||||||
|
|
Loading…
Reference in New Issue