diff --git a/bikeshop_project/bike/serializers.py b/bikeshop_project/bike/serializers.py index c5fa9fd..dc21666 100644 --- a/bikeshop_project/bike/serializers.py +++ b/bikeshop_project/bike/serializers.py @@ -6,3 +6,4 @@ from bike.models import Bike class BikeSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Bike + fields = '__all__' diff --git a/bikeshop_project/bike/urls.py b/bikeshop_project/bike/urls.py index f9f6250..e1166e2 100644 --- a/bikeshop_project/bike/urls.py +++ b/bikeshop_project/bike/urls.py @@ -2,12 +2,12 @@ from django.conf.urls import url, include from rest_framework import routers from bike import views -from .views import BikesView +from .views import BikesView, BikeViewSet -router = routers.DefaultRouter() -router.register(r'bikes', views.BikeViewSet) +apiRoutes = ( + (r'bikes', BikeViewSet), +) urlpatterns = [ - url(r'^api/', include(router.urls, namespace='api')), url(r'^$', BikesView.as_view(), name='bikes') ] diff --git a/bikeshop_project/bikeshop/urls.py b/bikeshop_project/bikeshop/urls.py index f1da2b1..3605ad1 100644 --- a/bikeshop_project/bikeshop/urls.py +++ b/bikeshop_project/bikeshop/urls.py @@ -22,9 +22,19 @@ from rest_framework import routers from rest_framework_jwt.views import obtain_jwt_token import registration +import bike +from bike import urls as bike_urls from core import urls as core_urls from registration import urls as member_urls -from bike import urls as bike_urls + +routeLists = [ + bike.urls.apiRoutes, +] + +router = routers.DefaultRouter() +for routeList in routeLists: + for route in routeList: + router.register(route[0], route[1]) routeLists = [ registration.urls.apiRoutes,