adamcharnock / django-hordak

Double entry accounting in Django
http://django-hordak.readthedocs.io
MIT License
228 stars 55 forks source link

Do we allow some kind of model customisation? #132

Open adamcharnock opened 6 days ago

adamcharnock commented 6 days ago

We've had some various requests which have boiled down to users needing to store extra data against Hordak models. Right now we just suggest users create their own model with a one-to-one relationship to the Hordak model. But it is worth considering other options.

Option 1: Allow extending the models

This is the same approach as Django's auth system, i.e. USER_MODEL=..., then calling get_user_model() in your code. This gives the maximal flexibility, but I don't like it because:

Option 2: Provide each model with an extensible field

Here we provide each model with a flexible field for extra data. For example, a JSONField called extra. I like this for its simplicity.

I also think we could provide some quality-of-life settings around this data. For example, we could provide settings that allow users to add keys in the extra field to the admin filtering UI or search box. Plus users would still be free to create indexes as they desire in their own migrations.

Option 3: One-to-one relationships (the status quo)

(ran out of time, got to go for now)