Browse Source

Basic bikes endpoint.

feature/bike-tracking
Drew Larson 8 years ago
parent
commit
243d7b06cb
  1. 1
      bikeshop_project/bike/serializers.py
  2. 8
      bikeshop_project/bike/urls.py
  3. 12
      bikeshop_project/bikeshop/urls.py

1
bikeshop_project/bike/serializers.py

@ -6,3 +6,4 @@ from bike.models import Bike
class BikeSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Bike
fields = '__all__'

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

12
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,

Loading…
Cancel
Save