Skip to content

Instantly share code, notes, and snippets.

View marknagelberg's full-sized avatar

Mark Nagelberg marknagelberg

View GitHub Profile
@tachyondecay
tachyondecay / models.py
Last active July 7, 2024 09:00
Tags in Flask via SQLalchemy and association proxies
from app import db
from sqlalchemy import desc, event, func, orm
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy_utils import ArrowType, auto_delete_orphans
from slugify import slugify_unicode
tags = db.Table('tag_associations',
db.Column('tag_id', db.Integer, db.ForeignKey('tags.id')),
db.Column('article_id', db.Integer, db.ForeignKey('articles.id')))