diff --git a/db_edit.py b/db_edit.py index b4ba391..6bf67e0 100644 --- a/db_edit.py +++ b/db_edit.py @@ -1306,15 +1306,17 @@ def api_create_category(): data = request.json with db.conn.cursor() as cursor: cursor.execute(""" - INSERT INTO categories (ID, TITLE, description, image_url, tg_id, marked_for_publication) - VALUES (%s, %s, %s, %s, %s, %s) + INSERT INTO categories (ID, TITLE, description, image_url, tg_id, marked_for_publication, is_tg_published, tg_published_date) + VALUES (%s, %s, %s, %s, %s, %s, %s, %s) """, ( data.get('id'), data.get('title', ''), data.get('description', ''), data.get('image_url', ''), data.get('tg_id'), - bool(data.get('marked_for_publication', False)) + bool(data.get('marked_for_publication', False)), + bool(data.get('is_tg_published', False)), + data.get('tg_published_date') or None )) db.conn.commit() client_ip = get_client_ip() @@ -1356,7 +1358,8 @@ def api_update_category(category_id): # Обновляем категорию, включая ID если он изменился cursor.execute(""" UPDATE categories - SET ID = %s, TITLE = %s, description = %s, image_url = %s, tg_id = %s, marked_for_publication = %s + SET ID = %s, TITLE = %s, description = %s, image_url = %s, tg_id = %s, + marked_for_publication = %s, is_tg_published = %s, tg_published_date = %s WHERE AUTO_ID = %s """, ( new_id, @@ -1365,6 +1368,8 @@ def api_update_category(category_id): data.get('image_url', ''), data.get('tg_id'), bool(data.get('marked_for_publication', False)), + bool(data.get('is_tg_published', False)), + data.get('tg_published_date') or None, auto_id )) db.conn.commit() diff --git a/templates/edit_category.html b/templates/edit_category.html index dd9d190..9a91f29 100644 --- a/templates/edit_category.html +++ b/templates/edit_category.html @@ -122,6 +122,22 @@ + +
+ + +
+ + +
+
+ +
+
+ +
+
+