mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
import raw json/html
This commit is contained in:
@@ -35,7 +35,8 @@ from cookbook.helper.permission_helper import (CustomIsAdmin, CustomIsGuest,
|
||||
CustomIsOwner, CustomIsShare,
|
||||
CustomIsShared, CustomIsUser,
|
||||
group_required)
|
||||
from cookbook.helper.recipe_url_import import get_from_html, find_recipe_json
|
||||
from cookbook.helper.recipe_url_import import get_from_html
|
||||
from cookbook.helper.recipe_raw_import import get_from_raw
|
||||
from cookbook.models import (CookLog, Food, Ingredient, Keyword, MealPlan,
|
||||
MealType, Recipe, RecipeBook, ShoppingList,
|
||||
ShoppingListEntry, ShoppingListRecipe, Step,
|
||||
@@ -696,6 +697,16 @@ def recipe_from_url(request):
|
||||
)
|
||||
|
||||
|
||||
@group_required('user')
|
||||
def recipe_from_raw(request):
|
||||
raw_text = request.POST['raw_text']
|
||||
recipe_json, recipe_tree = get_from_raw(raw_text)
|
||||
return JsonResponse({
|
||||
'recipe_tree': recipe_tree,
|
||||
'recipe_json': recipe_json
|
||||
})
|
||||
|
||||
|
||||
@group_required('admin')
|
||||
def get_backup(request):
|
||||
if not request.user.is_superuser:
|
||||
|
||||
Reference in New Issue
Block a user