La version 5 de Planète Casio. Regroupe le forum, les programmes, les tutoriel, les sprites et tous les autres outils développés par nos soins.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

users.py 687B

1234567891011121314151617181920
  1. from flask import redirect, url_for, abort
  2. from flask_login import login_required, current_user, logout_user
  3. from app import app, db
  4. from app.forms.account import UpdateAccountForm, RegistrationForm, DeleteAccountForm
  5. from app.models.users import Member
  6. from app.utils.render import render
  7. @app.route('/user/<username>')
  8. def user(username):
  9. user = Member.query.filter_by(name=username).first()
  10. if not user:
  11. abort(404)
  12. return render('user.html', user=user)
  13. @app.route('/user/id/<int:user_id>')
  14. def user_by_id(user_id):
  15. user = Member.query.filter_by(id=user_id).first()
  16. if not user:
  17. abort(404)
  18. return redirect(url_for('user', username=user.name))