@dp.message(Edittovar.name)
async def edit_name(message: Message, state: FSMContext) -> None:
await state.update_data(name=message.text)
await state.set_state(Edittovar.about)
await message.answer("Введите новое описание товара")
date = []
[date.append(value) for value in data.items()]
conn = data.connect_data(host="localhost", password="Dan098070", data="data")
cur = conn.cursor()
cur.execute("UPDATE aromki SET name = {} WHERE id = '{}'".format(date[0],pg))
conn.commit()
conn.close()
cur.close()
@dp.message(Edittovar.about)
async def edit_about(message: Message, state: FSMContext) -> None:
await state.update_data(about=message.text)
await state.set_state(Edittovar.url)
await message.answer("Введите новый юрл товара")
date = []
[date.append(value) for value in data.items()]
conn = data.connect_data(host="localhost", password="Dan098070", data="data")
cur = conn.cursor()
cur.execute("UPDATE aromki SET about = {} WHERE id = '{}'".format(date[1],pg))
conn.commit()
conn.close()
cur.close()
@dp.message(Edittovar.url)
async def edit_url(message: Message, state: FSMContext) -> None:
await state.update_data(url=message.text)
await state.set_state(Edittovar.photo)
await message.answer("Новую фотку")
date = []
[date.append(value) for value in data.items()]
conn = data.connect_data(host="localhost", password="Dan098070", data="data")
cur = conn.cursor()
cur.execute("UPDATE aromki SET url = {} WHERE id = '{}'".format(date[2],pg))
conn.commit()
conn.close()
cur.close()
@dp.message(Edittovar.photo)
async def edit_url(message: Message, state: FSMContext) -> None:
await state.update_data(photo=message.text)
data = await state.get_data()
date = []
[date.append(value) for value in data.items()]
conn = connect_data(host="localhost", password="Dan098070", data="data")
cur = conn.cursor()
cur.execute(f"UPDATE aromki SET photo = {date[3]} WHERE id = '{pg}'")
conn.commit()
conn.close()
cur.close()
await state.clear()