Browse Source

Add members endpoint.

feature/bike-tracking
Drew Larson 8 years ago
parent
commit
d1a1771031
  1. 2
      bikeshop_project/bikeshop/urls.py
  2. 9
      bikeshop_project/registration/serializers.py
  3. 3
      bikeshop_project/registration/views.py

2
bikeshop_project/bikeshop/urls.py

@ -23,12 +23,14 @@ from rest_framework_jwt.views import obtain_jwt_token
import registration
import bike
import registration
from bike import urls as bike_urls
from core import urls as core_urls
from registration import urls as member_urls
routeLists = [
bike.urls.apiRoutes,
registration.urls.apiRoutes,
]
router = routers.DefaultRouter()

9
bikeshop_project/registration/serializers.py

@ -4,10 +4,9 @@ from rest_framework.serializers import ModelSerializer
from .models import Member
class MemberSerializer(ModelSerializer):
first_name = serializers.CharField(allow_blank=True, required=False)
last_name = serializers.CharField(allow_blank=True, required=False)
class MemberSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Member
fields = ('first_name', 'last_name', 'email', 'id', 'banned', 'suspended')
fields = ('email', 'email_consent', 'email_consent', 'first_name', 'last_name', 'preferred_name',
'date_of_birth', 'guardian_name', 'phone', 'street', 'city', 'province', 'country', 'post_code',
'waiver', 'is_active', 'banned', 'suspended')

3
bikeshop_project/registration/views.py

@ -9,6 +9,7 @@ from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import TemplateView, View
from haystack.query import SearchQuerySet
from rest_framework import serializers
from rest_framework import viewsets
from rest_framework.renderers import JSONRenderer
from rest_framework.serializers import ModelSerializer
@ -67,7 +68,7 @@ class MemberSearchView(View):
class VisitSerializer(ModelSerializer):
member = MemberSerializer()
member = MemberSignInSerializer()
class Meta:
model = Visit

Loading…
Cancel
Save