This commit is contained in:
-21
@@ -141,17 +141,6 @@ class DatabaseManager:
|
|||||||
cursor.execute("SELECT * FROM events WHERE id = %s", (event_id,))
|
cursor.execute("SELECT * FROM events WHERE id = %s", (event_id,))
|
||||||
return cursor.fetchone()
|
return cursor.fetchone()
|
||||||
|
|
||||||
def get_venues(self):
|
|
||||||
"""Получает список всех уникальных площадок из таблицы events"""
|
|
||||||
with self.conn.cursor() as cursor:
|
|
||||||
cursor.execute("""
|
|
||||||
SELECT DISTINCT unit_name
|
|
||||||
FROM events
|
|
||||||
WHERE unit_name IS NOT NULL AND unit_name != ''
|
|
||||||
ORDER BY unit_name
|
|
||||||
""")
|
|
||||||
return cursor.fetchall()
|
|
||||||
|
|
||||||
def toggle_event_publication(self, event_id):
|
def toggle_event_publication(self, event_id):
|
||||||
with self.conn.cursor() as cursor:
|
with self.conn.cursor() as cursor:
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
@@ -610,16 +599,6 @@ def logout():
|
|||||||
log_event(f"Пользователь {username} вышел из системы с IP {client_ip}")
|
log_event(f"Пользователь {username} вышел из системы с IP {client_ip}")
|
||||||
return redirect(url_for('zilant.login'))
|
return redirect(url_for('zilant.login'))
|
||||||
|
|
||||||
@bp.route('/api/venues')
|
|
||||||
@login_required
|
|
||||||
def api_venues():
|
|
||||||
db = get_db()
|
|
||||||
try:
|
|
||||||
venues = db.get_venues()
|
|
||||||
return jsonify(venues)
|
|
||||||
finally:
|
|
||||||
db.close()
|
|
||||||
|
|
||||||
@bp.route('/api/posts')
|
@bp.route('/api/posts')
|
||||||
@login_required
|
@login_required
|
||||||
def api_posts():
|
def api_posts():
|
||||||
|
|||||||
@@ -260,8 +260,8 @@
|
|||||||
// Добавляем площадки
|
// Добавляем площадки
|
||||||
venues.forEach(venue => {
|
venues.forEach(venue => {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = venue.unit_name;
|
option.value = venue.name;
|
||||||
option.textContent = venue.unit_name;
|
option.textContent = venue.name;
|
||||||
select.appendChild(option);
|
select.appendChild(option);
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user