Skip to content

Instantly share code, notes, and snippets.

@ngse
ngse / audit_mixin.py
Last active May 21, 2023 13:56
Rough attempt at implementing an audit log against Flask/Flask Login/SQLAlchemy models
# Requires use of Flask Login for the user tracking
# Implement by using AuditableMixin in your model class declarations
# e.g. class ImportantThing(AuditableMixin, Base):
import json
from flask_login import current_user
from sqlalchemy import event, inspect
from sqlalchemy.orm import class_mapper
from sqlalchemy.orm.attributes import get_history
@ngse
ngse / gist:d39fac10ff9112d19a89
Created September 26, 2014 10:46
Keybase.io proof
### Keybase proof
I hereby claim:
* I am ngse on github.
* I am robadob (https://keybase.io/robadob) on keybase.
* I have a public key whose fingerprint is EFCF 7278 F23E ED03 0BE3 4D51 B754 34E5 7730 CFEA
To claim this, I am signing this object: