Aleksmorshen commited on
Commit
b755279
·
verified ·
1 Parent(s): b4fd17f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -44,7 +44,6 @@ body {{ font-family: Arial, sans-serif; margin: 20px; }}
44
  .header {{ font-size: 24px; margin-bottom: 20px; }}
45
  .products {{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }}
46
  .product {{ border: 1px solid #ddd; padding: 15px; border-radius: 5px; }}
47
- .product img {{ max-width: 200px; max-height: 200px; }}
48
  form {{ max-width: 500px; margin: 20px auto; }}
49
  input, textarea {{ width: 100%; margin: 5px 0; padding: 8px; }}
50
  button {{ background: #4CAF50; color: white; padding: 10px; border: none; cursor: pointer; }}
@@ -70,7 +69,6 @@ def catalog():
70
  products_html = ''.join([
71
  f'''<div class="product">
72
  <h3>{p['name']}</h3>
73
- <img src="{p['image']}">
74
  <p>{p['description']}</p>
75
  <p>Цена: {p['price']} руб.</p>
76
  </div>'''
@@ -90,8 +88,7 @@ def admin():
90
  new_product = {
91
  'name': request.form['name'],
92
  'description': request.form['description'],
93
- 'price': float(request.form['price']),
94
- 'image': request.form['image']
95
  }
96
  products.append(new_product)
97
  save_products(products)
@@ -107,7 +104,6 @@ def admin():
107
  <input type="text" name="name" placeholder="Название" required>
108
  <textarea name="description" placeholder="Описание" required></textarea>
109
  <input type="number" name="price" placeholder="Цена" required>
110
- <input type="url" name="image" placeholder="URL изображения" required>
111
  <button type="submit">Добавить товар</button>
112
  </form>
113
  ''')
 
44
  .header {{ font-size: 24px; margin-bottom: 20px; }}
45
  .products {{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }}
46
  .product {{ border: 1px solid #ddd; padding: 15px; border-radius: 5px; }}
 
47
  form {{ max-width: 500px; margin: 20px auto; }}
48
  input, textarea {{ width: 100%; margin: 5px 0; padding: 8px; }}
49
  button {{ background: #4CAF50; color: white; padding: 10px; border: none; cursor: pointer; }}
 
69
  products_html = ''.join([
70
  f'''<div class="product">
71
  <h3>{p['name']}</h3>
 
72
  <p>{p['description']}</p>
73
  <p>Цена: {p['price']} руб.</p>
74
  </div>'''
 
88
  new_product = {
89
  'name': request.form['name'],
90
  'description': request.form['description'],
91
+ 'price': float(request.form['price']) # Преобразуем цену в число
 
92
  }
93
  products.append(new_product)
94
  save_products(products)
 
104
  <input type="text" name="name" placeholder="Название" required>
105
  <textarea name="description" placeholder="Описание" required></textarea>
106
  <input type="number" name="price" placeholder="Цена" required>
 
107
  <button type="submit">Добавить товар</button>
108
  </form>
109
  ''')