dsite/recipe/urls.py
Ching d16cfa0ca2 feat(recipe views): 增加菜谱原材料统计接口
增加菜谱原材料统计接口

Signed-off-by: Ching <loooching@gmail.com>
2022-02-27 19:41:45 +08:00

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)),
]