24 lines
892 B
Python
24 lines
892 B
Python
from django.conf.urls import include, url
|
|
|
|
from django.urls import path
|
|
from recipe import views
|
|
|
|
|
|
# Wire up our API using automatic URL routing.
|
|
# Additionally, we include login URLs for the browsable API.
|
|
from rest_framework_nested import routers
|
|
|
|
router = routers.DefaultRouter()
|
|
router.register(r'recipe', views.RecipeAPI)
|
|
router.register(r'ingredient', views.IngredientAPI)
|
|
recipe_nested_router = routers.NestedSimpleRouter(router, r'recipe', lookup='recipe')
|
|
recipe_nested_router.register(r'recipe-ingredient', views.RecipeIngredientAPI)
|
|
|
|
urlpatterns = [
|
|
url(r'^week-recipe/$', views.WeekRecipeListAPI.as_view()),
|
|
url(r'^daily-recipe/(?P<pk>\d+)$', views.DailyRecipeAPI.as_view(), name='dailyrecipe-detail'),
|
|
url(r'^ingredient-summary/$', views.RecipeIngredientSummaryAPI.as_view()),
|
|
path(r'', include(router.urls)),
|
|
path(r'', include(recipe_nested_router.urls)),
|
|
]
|