poprawki w synchronizacji produktow
This commit is contained in:
13
app.py
13
app.py
@@ -220,7 +220,7 @@ def require_system_password():
|
||||
# specjalny wyjątek dla statycznych, ale sprawdzany ręcznie niżej
|
||||
if request.endpoint == 'static_bp.serve_js':
|
||||
# tu sprawdzamy czy to JS, który ma być chroniony
|
||||
protected_js = ["live.js", "list_guest.js", "hide_list.js", "socket_reconnect.js","sync_products.js", "expenses.js", "toggle_button.js"]
|
||||
protected_js = ["live.js", "list_guest.js", "hide_list.js", "socket_reconnect.js","product_suggestion.js", "expenses.js", "toggle_button.js"]
|
||||
requested_file = request.view_args.get("filename", "")
|
||||
if requested_file in protected_js:
|
||||
return redirect(url_for('system_auth', next=request.url))
|
||||
@@ -875,16 +875,17 @@ def sync_suggestion_ajax(item_id):
|
||||
else:
|
||||
return jsonify({'success': True, 'message': f'Sugestia dla produktu „{item.name}” już istnieje.'})
|
||||
|
||||
@app.route('/admin/delete_suggestion/<int:suggestion_id>')
|
||||
@app.route('/admin/delete_suggestion/<int:suggestion_id>', methods=['POST'])
|
||||
@login_required
|
||||
def delete_suggestion(suggestion_id):
|
||||
def delete_suggestion_ajax(suggestion_id):
|
||||
if not current_user.is_admin:
|
||||
return redirect(url_for('index_guest'))
|
||||
return jsonify({'success': False, 'message': 'Brak uprawnień'}), 403
|
||||
|
||||
suggestion = SuggestedProduct.query.get_or_404(suggestion_id)
|
||||
db.session.delete(suggestion)
|
||||
db.session.commit()
|
||||
flash('Sugestia została usunięta', 'success')
|
||||
return redirect(url_for('list_products'))
|
||||
|
||||
return jsonify({'success': True, 'message': 'Sugestia została usunięta.'})
|
||||
|
||||
@app.route('/admin/expenses_data')
|
||||
@login_required
|
||||
|
Reference in New Issue
Block a user