display of external recipes

This commit is contained in:
vabene1111
2021-01-13 02:16:16 +01:00
parent 1bb412e007
commit bb43ed203a
9 changed files with 76 additions and 18 deletions

View File

@@ -191,7 +191,7 @@ class RecipeSerializer(WritableNestedModelSerializer):
fields = (
'id', 'name', 'image', 'keywords', 'steps', 'working_time',
'waiting_time', 'created_by', 'created_at', 'updated_at',
'internal', 'nutrition', 'servings'
'internal', 'nutrition', 'servings', 'file_path'
)
read_only_fields = ['image', 'created_by', 'created_at']

View File

@@ -24,7 +24,7 @@
<script type="application/javascript">
window.RECIPE_ID = 6;
window.RECIPE_ID = {{pk}};
window.USER_PREF = {
'use_fractions': {% if request.user.userpreference.use_fractions %} true {% else %} false {% endif %},
'ingredient_decimals': {{ request.user.userpreference.ingredient_decimals }},

View File

@@ -56,7 +56,7 @@ urlpatterns = [
),
name='service_worker'
),
path('test/', views.test, name='view_test'),
path('test/<int:pk>', views.test, name='view_test'),
path('import/', import_export.import_recipe, name='view_import'),
path('export/', import_export.export_recipe, name='view_export'),

View File

@@ -493,8 +493,8 @@ def offline(request):
return render(request, 'offline.html', {})
def test(request):
def test(request, pk):
if not settings.DEBUG:
return HttpResponseRedirect(reverse('index'))
return render(request, 'test.html', {'test': None})
return render(request, 'test.html', {'pk': pk})