Update app.py
Browse files
app.py
CHANGED
|
@@ -276,9 +276,11 @@ def delete_post(post_id):
|
|
| 276 |
|
| 277 |
|
| 278 |
|
|
|
|
| 279 |
@app.route('/follow/<int:user_id>', methods=['POST'])
|
| 280 |
@login_required
|
| 281 |
-
def follow(user_id
|
|
|
|
| 282 |
user_to_follow = User.query.get(user_id)
|
| 283 |
if user_to_follow is None:
|
| 284 |
flash('User not found.', 'error')
|
|
@@ -296,12 +298,7 @@ def follow(user_id, page):
|
|
| 296 |
return redirect(url_for('view_profile', user_id=user_id))
|
| 297 |
|
| 298 |
flash(f"You are now following {user_to_follow.username}.", 'success')
|
| 299 |
-
|
| 300 |
-
return redirect(url_for('view_profile', user_id=user_id))
|
| 301 |
-
elif page == 'search':
|
| 302 |
-
return redirect(url_for('search_results', query=request.form['query']))
|
| 303 |
-
else:
|
| 304 |
-
return redirect(url_for('view_profile', user_id=user_id))
|
| 305 |
|
| 306 |
|
| 307 |
@app.route('/unfollow/<int:user_id>', methods=['POST'])
|
|
|
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
+
|
| 280 |
@app.route('/follow/<int:user_id>', methods=['POST'])
|
| 281 |
@login_required
|
| 282 |
+
def follow(user_id):
|
| 283 |
+
|
| 284 |
user_to_follow = User.query.get(user_id)
|
| 285 |
if user_to_follow is None:
|
| 286 |
flash('User not found.', 'error')
|
|
|
|
| 298 |
return redirect(url_for('view_profile', user_id=user_id))
|
| 299 |
|
| 300 |
flash(f"You are now following {user_to_follow.username}.", 'success')
|
| 301 |
+
return redirect(url_for('view_profile', user_id=user_id))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
|
| 303 |
|
| 304 |
@app.route('/unfollow/<int:user_id>', methods=['POST'])
|