What is the best way to register user actions in jars?

I would like to register user actions whenever a user logs in / out and adds, edits, deletes objects on models of my site in a bulb. What is the best way to do this? I would also like to show old data and new changed data that occur using wtfforms. I use a jar and Flask-SQLAlchemy. I want something similar to what the Django framework offers in the hlink History link for related objects.

+6
source share
2 answers

Use signals. Take a look at this

http://flask.pocoo.org/docs/signals/

Using signals, you can track any actions, such as adding / editing, etc. as needed. All you have to do is

from blinker import Namespace my_signals = Namespace() def add_user(): # add user code here user_added = my_signals.signal('user-added') 
+6
source

You can access flask-login also using signals.

+2
source

Source: https://habr.com/ru/post/947529/


All Articles