fix(blueprints): Poprawka url_for w blueprintach - dodanie prefixu
- classifieds/routes.py: .classifieds_index - calendar/routes.py: .calendar_index - contacts/routes.py: .contacts_list, .contact_detail Błąd powodował 500 przy dodawaniu ogłoszeń B2B. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
bc58d31c4d
commit
a06cd335d8
@ -117,7 +117,7 @@ def event(event_id):
|
||||
event = db.query(NordaEvent).filter(NordaEvent.id == event_id).first()
|
||||
if not event:
|
||||
flash('Wydarzenie nie istnieje.', 'error')
|
||||
return redirect(url_for('calendar_index'))
|
||||
return redirect(url_for('.calendar_index'))
|
||||
|
||||
# Sprawdź czy użytkownik jest zapisany
|
||||
user_attending = db.query(EventAttendee).filter(
|
||||
|
||||
@ -98,7 +98,7 @@ def new():
|
||||
db.commit()
|
||||
|
||||
flash('Ogłoszenie dodane.', 'success')
|
||||
return redirect(url_for('classifieds_index'))
|
||||
return redirect(url_for('.classifieds_index'))
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
@ -117,7 +117,7 @@ def view(classified_id):
|
||||
|
||||
if not classified:
|
||||
flash('Ogłoszenie nie istnieje.', 'error')
|
||||
return redirect(url_for('classifieds_index'))
|
||||
return redirect(url_for('.classifieds_index'))
|
||||
|
||||
# Zwiększ licznik wyświetleń (handle NULL)
|
||||
classified.views_count = (classified.views_count or 0) + 1
|
||||
|
||||
@ -108,7 +108,7 @@ def detail(contact_id):
|
||||
|
||||
if not contact:
|
||||
flash('Kontakt nie został znaleziony.', 'error')
|
||||
return redirect(url_for('contacts_list'))
|
||||
return redirect(url_for('.contacts_list'))
|
||||
|
||||
# Get other contacts from the same organization
|
||||
related_contacts = db.query(ExternalContact).filter(
|
||||
@ -179,7 +179,7 @@ def add():
|
||||
db.commit()
|
||||
|
||||
flash(f'Kontakt {contact.full_name} został dodany.', 'success')
|
||||
return redirect(url_for('contact_detail', contact_id=contact.id))
|
||||
return redirect(url_for('.contact_detail', contact_id=contact.id))
|
||||
|
||||
except Exception as e:
|
||||
db.rollback()
|
||||
@ -211,12 +211,12 @@ def edit(contact_id):
|
||||
|
||||
if not contact:
|
||||
flash('Kontakt nie został znaleziony.', 'error')
|
||||
return redirect(url_for('contacts_list'))
|
||||
return redirect(url_for('.contacts_list'))
|
||||
|
||||
# Check permissions
|
||||
if not current_user.is_admin and contact.created_by != current_user.id:
|
||||
flash('Nie masz uprawnień do edycji tego kontaktu.', 'error')
|
||||
return redirect(url_for('contact_detail', contact_id=contact_id))
|
||||
return redirect(url_for('.contact_detail', contact_id=contact_id))
|
||||
|
||||
if request.method == 'POST':
|
||||
# Parse related_links from form (JSON)
|
||||
@ -253,7 +253,7 @@ def edit(contact_id):
|
||||
db.commit()
|
||||
|
||||
flash(f'Kontakt {contact.full_name} został zaktualizowany.', 'success')
|
||||
return redirect(url_for('contact_detail', contact_id=contact.id))
|
||||
return redirect(url_for('.contact_detail', contact_id=contact.id))
|
||||
|
||||
# GET - show form with existing data
|
||||
return render_template('contacts/form.html',
|
||||
@ -280,12 +280,12 @@ def delete(contact_id):
|
||||
|
||||
if not contact:
|
||||
flash('Kontakt nie został znaleziony.', 'error')
|
||||
return redirect(url_for('contacts_list'))
|
||||
return redirect(url_for('.contacts_list'))
|
||||
|
||||
# Check permissions
|
||||
if not current_user.is_admin and contact.created_by != current_user.id:
|
||||
flash('Nie masz uprawnień do usunięcia tego kontaktu.', 'error')
|
||||
return redirect(url_for('contact_detail', contact_id=contact_id))
|
||||
return redirect(url_for('.contact_detail', contact_id=contact_id))
|
||||
|
||||
# Soft delete
|
||||
contact.is_active = False
|
||||
@ -293,7 +293,7 @@ def delete(contact_id):
|
||||
db.commit()
|
||||
|
||||
flash(f'Kontakt {contact.full_name} został usunięty.', 'success')
|
||||
return redirect(url_for('contacts_list'))
|
||||
return redirect(url_for('.contacts_list'))
|
||||
|
||||
finally:
|
||||
db.close()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user