Update app.py
Browse files
app.py
CHANGED
|
@@ -1169,6 +1169,7 @@ def profile():
|
|
| 1169 |
padding: 8px 16px;
|
| 1170 |
font-size: 0.9em;
|
| 1171 |
margin-top: 10px;
|
|
|
|
| 1172 |
}
|
| 1173 |
.delete-btn:hover {
|
| 1174 |
background: #45b7b0;
|
|
@@ -1536,7 +1537,8 @@ def upload():
|
|
| 1536 |
uploader = session['username']
|
| 1537 |
|
| 1538 |
if not title or not file:
|
| 1539 |
-
|
|
|
|
| 1540 |
|
| 1541 |
filename = secure_filename(file.filename)
|
| 1542 |
temp_path = os.path.join('uploads', filename)
|
|
@@ -1574,6 +1576,7 @@ def upload():
|
|
| 1574 |
|
| 1575 |
if os.path.exists(temp_path):
|
| 1576 |
os.remove(temp_path)
|
|
|
|
| 1577 |
return redirect(url_for('profile'))
|
| 1578 |
|
| 1579 |
is_authenticated = 'username' in session
|
|
@@ -1625,6 +1628,13 @@ def upload():
|
|
| 1625 |
background: var(--primary);
|
| 1626 |
transition: width 0.4s ease;
|
| 1627 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1628 |
</style>
|
| 1629 |
</head>
|
| 1630 |
<body>
|
|
@@ -1633,6 +1643,13 @@ def upload():
|
|
| 1633 |
<button class="theme-toggle" onclick="toggleTheme()">🌙</button>
|
| 1634 |
<div class="container">
|
| 1635 |
<h1>Upload Content</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1636 |
<form id="upload-form" enctype="multipart/form-data">
|
| 1637 |
<input type="text" name="title" placeholder="Title" required>
|
| 1638 |
<textarea name="description" placeholder="Description" rows="5"></textarea>
|
|
@@ -2104,6 +2121,7 @@ def admin_panel():
|
|
| 2104 |
padding: 8px 16px;
|
| 2105 |
font-size: 0.9em;
|
| 2106 |
margin-top: 10px;
|
|
|
|
| 2107 |
}
|
| 2108 |
.delete-btn:hover {
|
| 2109 |
background: #45b7b0;
|
|
|
|
| 1169 |
padding: 8px 16px;
|
| 1170 |
font-size: 0.9em;
|
| 1171 |
margin-top: 10px;
|
| 1172 |
+
display: block; /* Убедимся, что кнопка отображается корректно */
|
| 1173 |
}
|
| 1174 |
.delete-btn:hover {
|
| 1175 |
background: #45b7b0;
|
|
|
|
| 1537 |
uploader = session['username']
|
| 1538 |
|
| 1539 |
if not title or not file:
|
| 1540 |
+
flash('Please provide a title and select a file')
|
| 1541 |
+
return redirect(url_for('upload'))
|
| 1542 |
|
| 1543 |
filename = secure_filename(file.filename)
|
| 1544 |
temp_path = os.path.join('uploads', filename)
|
|
|
|
| 1576 |
|
| 1577 |
if os.path.exists(temp_path):
|
| 1578 |
os.remove(temp_path)
|
| 1579 |
+
flash('Post uploaded successfully!')
|
| 1580 |
return redirect(url_for('profile'))
|
| 1581 |
|
| 1582 |
is_authenticated = 'username' in session
|
|
|
|
| 1628 |
background: var(--primary);
|
| 1629 |
transition: width 0.4s ease;
|
| 1630 |
}
|
| 1631 |
+
.flash {
|
| 1632 |
+
color: var(--secondary);
|
| 1633 |
+
text-align: center;
|
| 1634 |
+
margin-bottom: 20px;
|
| 1635 |
+
font-size: 1.1em;
|
| 1636 |
+
font-weight: 500;
|
| 1637 |
+
}
|
| 1638 |
</style>
|
| 1639 |
</head>
|
| 1640 |
<body>
|
|
|
|
| 1643 |
<button class="theme-toggle" onclick="toggleTheme()">🌙</button>
|
| 1644 |
<div class="container">
|
| 1645 |
<h1>Upload Content</h1>
|
| 1646 |
+
{% with messages = get_flashed_messages() %}
|
| 1647 |
+
{% if messages %}
|
| 1648 |
+
{% for message in messages %}
|
| 1649 |
+
<div class="flash">{{ message }}</div>
|
| 1650 |
+
{% endfor %}
|
| 1651 |
+
{% endif %}
|
| 1652 |
+
{% endwith %}
|
| 1653 |
<form id="upload-form" enctype="multipart/form-data">
|
| 1654 |
<input type="text" name="title" placeholder="Title" required>
|
| 1655 |
<textarea name="description" placeholder="Description" rows="5"></textarea>
|
|
|
|
| 2121 |
padding: 8px 16px;
|
| 2122 |
font-size: 0.9em;
|
| 2123 |
margin-top: 10px;
|
| 2124 |
+
display: block; /* Убедимся, что кнопка отображается корректно */
|
| 2125 |
}
|
| 2126 |
.delete-btn:hover {
|
| 2127 |
background: #45b7b0;
|