food to tree (model, api, serializer)

This commit is contained in:
smilerz
2021-08-15 08:39:45 -05:00
parent 6ec0c1c71d
commit 24a575c2d5
15 changed files with 399 additions and 76 deletions

View File

@ -87,7 +87,7 @@ urlpatterns = [
path('edit/recipe/convert/<int:pk>/', edit.convert_recipe, name='edit_convert_recipe'),
path('edit/storage/<int:pk>/', edit.edit_storage, name='edit_storage'),
path('edit/ingredient/', edit.edit_ingredients, name='edit_food'),
path('edit/ingredient/', edit.edit_ingredients, name='edit_food'), # TODO is this still needed?
path('delete/recipe-source/<int:pk>/', delete.delete_recipe_source, name='delete_recipe_source'),
@ -109,9 +109,9 @@ urlpatterns = [
path('api/ingredient-from-string/', api.ingredient_from_string, name='api_ingredient_from_string'),
path('api/share-link/<int:pk>', api.share_link, name='api_share_link'),
path('dal/keyword/', dal.KeywordAutocomplete.as_view(), name='dal_keyword'), # TODO is this deprecated?
path('dal/food/', dal.IngredientsAutocomplete.as_view(), name='dal_food'), # TODO is this deprecated?
path('dal/unit/', dal.UnitAutocomplete.as_view(), name='dal_unit'), # TODO is this deprecated?
path('dal/keyword/', dal.KeywordAutocomplete.as_view(), name='dal_keyword'), # TODO is this still needed?
path('dal/food/', dal.IngredientsAutocomplete.as_view(), name='dal_food'), # TODO is this still needed?
path('dal/unit/', dal.UnitAutocomplete.as_view(), name='dal_unit'),
path('telegram/setup/<int:pk>', telegram.setup_bot, name='telegram_setup'),
path('telegram/remove/<int:pk>', telegram.remove_bot, name='telegram_remove'),
@ -135,9 +135,13 @@ urlpatterns = [
name='web_manifest'),
]
# generic_models = (
# Recipe, RecipeImport, Storage, RecipeBook, MealPlan, SyncLog, Sync,
# Comment, RecipeBookEntry, Keyword, Food, ShoppingList, InviteLink
# )
generic_models = (
Recipe, RecipeImport, Storage, RecipeBook, MealPlan, SyncLog, Sync,
Comment, RecipeBookEntry, Food, ShoppingList, InviteLink
Comment, RecipeBookEntry, ShoppingList, InviteLink
)
for m in generic_models:
@ -176,7 +180,7 @@ for m in generic_models:
)
)
tree_models = [Keyword]
tree_models = [Keyword, Food]
for m in tree_models:
py_name = get_model_name(m)
url_name = py_name.replace('_', '-')