mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 04:10:06 -05:00
Merge branch 'feature/recipe-edit-vue' into develop
# Conflicts: # vue/vue.config.js # vue/webpack-stats.json
This commit is contained in:
@@ -548,9 +548,7 @@ class RecipeViewSet(viewsets.ModelViewSet):
|
||||
if obj.get_space() != request.space:
|
||||
raise PermissionDenied(detail='You do not have the required permission to perform this action', code=403)
|
||||
|
||||
serializer = self.serializer_class(
|
||||
obj, data=request.data, partial=True
|
||||
)
|
||||
serializer = self.serializer_class(obj, data=request.data, partial=True)
|
||||
|
||||
if self.request.space.demo:
|
||||
raise PermissionDenied(detail='Not available in demo', code=None)
|
||||
@@ -558,8 +556,11 @@ class RecipeViewSet(viewsets.ModelViewSet):
|
||||
if serializer.is_valid():
|
||||
serializer.save()
|
||||
|
||||
img, filetype = handle_image(request, obj.image)
|
||||
obj.image = File(img, name=f'{uuid.uuid4()}_{obj.pk}{filetype}')
|
||||
if serializer.validated_data == {}:
|
||||
obj.image = None
|
||||
else:
|
||||
img, filetype = handle_image(request, obj.image)
|
||||
obj.image = File(img, name=f'{uuid.uuid4()}_{obj.pk}{filetype}')
|
||||
obj.save()
|
||||
|
||||
return Response(serializer.data)
|
||||
|
||||
@@ -57,7 +57,7 @@ def internal_recipe_update(request, pk):
|
||||
recipe_instance = get_object_or_404(Recipe, pk=pk, space=request.space)
|
||||
|
||||
return render(
|
||||
request, 'forms/edit_internal_recipe.html', {'recipe': recipe_instance}
|
||||
request, 'edit_internal_recipe_v2.html', {'recipe': recipe_instance}
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user