Skip to content

Commit

Permalink
Recipe_del fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriaranam committed Jul 9, 2023
1 parent 627302c commit cb949a8
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def index():
@app.route("/home")
def home():
recetas = Receta.query.all()
print(f'ID DEL USER {current_user.id}')
return render_template ("home.html",recetas=recetas)


Expand Down
14 changes: 5 additions & 9 deletions funciones.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ def decorador(*args, **kwargs):
print(f'id receta: {receta.user_id}, id current user: {current_user.id}')
flash('no tienes permisos para modificar', category='error') #
return redirect(url_for('home')) # Devuelve al home



return decorador


Expand All @@ -55,12 +52,11 @@ def decorador(*args, **kwargs):
if not receta:
flash('La receta no existe para eliminar', category='error') # Devuelve un error 404 Not Found si la receta no existe
return redirect(url_for('home')) # Devuelve al home

if receta.user_id != current_user.id or current_user.rol != 'admin':
flash('no tienes permisos para eliminar', category='error') #
return redirect(url_for('home')) # Devuelve al home
return func(*args, **kwargs)

if receta.user_id == current_user.id or current_user.rol == 'admin':
return func(*args, **kwargs)
else:
flash('No tienes los permisos para eliminar', category='error')
return redirect (url_for('home'))
return decorador

def modo_admin(func):
Expand Down
Binary file added static/uploads/Ensalada_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added static/uploads/este no_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/uploads/este si_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/uploads/este si_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cb949a8

Please sign in to comment.