This commit is contained in:
pika 2025-03-30 22:01:42 +02:00
parent be6f7cfcbb
commit 9433d9d235
7 changed files with 189 additions and 84 deletions

View file

@ -305,8 +305,8 @@ def app_edit(app_id):
# Check if name changed and already exists on the same server
existing_app = App.query.filter(App.name == name,
App.server_id == server_id,
App.id != app.id).first()
App.server_id == server_id,
App.id != app.id).first()
if existing_app:
flash('Application with this name already exists on the selected server', 'danger')
return render_template(
@ -321,10 +321,13 @@ def app_edit(app_id):
app.server_id = server_id
app.documentation = documentation
db.session.commit()
flash('Application updated successfully', 'success')
return redirect(url_for('dashboard.app_view', app_id=app.id))
try:
db.session.commit()
flash('Application updated successfully', 'success')
return redirect(url_for('dashboard.app_view', app_id=app.id))
except Exception as e:
db.session.rollback()
flash(f'Error updating application: {str(e)}', 'danger')
return render_template(
'dashboard/app_form.html',