Skip to content

Python kitchen

Always cooking something nice!

  • contact us

Author: Abdur-Rahmaan Janhangeer

How to implement beautiful notifications in Flask
flask 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…
February 24, 2021 Abdur-Rahmaan Janhangeer
How to implement notification in Flask
shopyo flask

How to implement notification in Flask

Implementing notifications in Flask goes way beyond using flash. You have to add this snippet in your templates: <div id="flashed-messages">…
February 24, 2021 Abdur-Rahmaan Janhangeer
How to prevent the Open Redirect vulnerability with the next parameter in Flask
flask security

How to prevent the Open Redirect vulnerability with the next parameter in Flask

Let’s say someone codes a url like this: http://domain.com/do/something?next=http://domain.com/homepage Now an attacker can craft the url like that: http://domain.com/do/something?next=http://evildomain.com/homepage If…
February 24, 2021 Abdur-Rahmaan Janhangeer
How to define global template variables in Flask
flask

How to define global template variables in Flask

Let’s say you want to have some variables available in all templates by default. There’s how you do it: @app.context_processor…
February 24, 2021February 24, 2021 Abdur-Rahmaan Janhangeer
How to disable csrf protection for particular routes in Flask-wtf
flask

How to disable csrf protection for particular routes in Flask-wtf

Flask-wtf recommends using @csrf.exempt to disable csrf protection for particular routes as in the case of APIs. Now this is…
February 24, 2021 Abdur-Rahmaan Janhangeer
How to use Flask-admin with Flask-login
flask

How to use Flask-admin with Flask-login

Steps: Have a login route accept a next parameter Define your model view and admin index view Register models In…
February 24, 2021 Abdur-Rahmaan Janhangeer
How to correctly use the next parameter in login and logout in Flask
flask shopyo

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…
February 24, 2021February 24, 2021 Abdur-Rahmaan Janhangeer
The Zen Of Python: A Most In Depth Article
zen

The Zen Of Python: A Most In Depth Article

Note: I wrote a quite complete article on the Zen but for some reason it went down in seo history.…
December 23, 2020February 24, 2021 Abdur-Rahmaan Janhangeer
Python Generators:  The In-depth Article You’ve Always Wanted
generators

Python Generators: The In-depth Article You’ve Always Wanted

Table of contents Why were Python generators introduced? How do Python Generators differ from normal functions? Execution flow Immediate usefulness…
December 10, 2020 Abdur-Rahmaan Janhangeer

Posts navigation

Older Posts

Newsletter Signup

WordPress Theme: BlogGrid by TwoPoints.