Saturday, May 21, 2016

Django-Moderation

It would be nice if there were a sqlalchemy/flask equivalent to this: https://github.com/dominno/django-moderation

The equivalent might use sqlalchemy_utils for its generic relationships: https://sqlalchemy-utils.readthedocs.io/en/latest/generic_relationship.html

Thursday, May 19, 2016

Modified Preorder Tree Traversal

This was a great explanation of Modified Preorder Tree Traversal (or MPTT): https://www.sitepoint.com/hierarchical-data-database-2/

A common use-case for MPTT is categorization data, like with the way django-oscar uses django-mptt: https://github.com/django-mptt/django-mptt

Sunday, May 8, 2016

Datatables - Uncaught TypeError: Cannot read property 'style' of undefined

If you see this error in datatables: "Uncaught TypeError: Cannot read property 'style' of undefined"

It's likely that you're missing a header column in your table. Make sure you have the same number of <th> elements as items in the "columns" section of your datatables initialization.

Select2 Replacement

This selectize.js library looks like a good replacement for Select2: https://selectize.github.io/selectize.js/

Wednesday, May 4, 2016

Javascript Data Tables


Sunday, April 10, 2016

SQLAlchemy - JSON not changing on commit

If your changes to a JSON, JSONB, or HSTORE field aren't saving after you commit, then you need to wrap your field in the MutableDict shown here: http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#sqlalchemy.dialects.postgresql.HSTORE