shopyo

How to implement beautiful notifications in Flask

Since you already know how to implement notifications, let’s see how to implement beautiful notifications in Flask. Using boostrap, we can do: # shopyoapi.html def notify(message, alert_type=”primary”): “”” Used with flash flash(notify(‘blabla’)) Parameters ———- message: str message to be displayed alert_type: str bootstrap class Returns ——- None “”” alert = “”” <div class=”shopyo-alert alert alert-{alert_type} …

How to implement beautiful notifications in Flask Read More »

How to correctly use the next parameter in login and logout in Flask

Here is a sample login and logout route taken from the shopyo web framework. You can learn here how is get_safe_redirect defined and why it is important @auth_blueprint.route(“/login”, methods=[“GET”, “POST”]) def login(): context = {} login_form = LoginForm() context[“form”] = login_form if login_form.validate_on_submit(): email = login_form.email.data password = login_form.password.data user = User.query.filter( func.lower(User.email) == func.lower(email) …

How to correctly use the next parameter in login and logout in Flask Read More »