zostera / django-modeltrans

Translate Django model fields in a PostgreSQL JSONField
http://django-modeltrans.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
65 stars 10 forks source link

Add additional supported fields #118

Open jacobwegner opened 5 months ago

jacobwegner commented 5 months ago

I have a use case where I would like to store localized fields that are not CharField or TextField fields.

I'd like to start with adding JSONField, which seems to work pretty well.

I would also like to explore FileField. That field just stores a path in the database, but will need some additional work to wrap it so it returns FieldFile instance as expected.

jacobwegner commented 5 months ago

I started out with #119 and #120 after reading this in the docs:

Behavior is tested using CharField() and TextField(), as these make most sense for translated values. Additional fields could make sense, and will likely work, but need extra test coverage.

I have also considered an alternate approach to satisfying #118 that I could draft and submit as a PR. This approach would replace #119 and #120 by pushing out to project-specific configuration, e.g., providing MODELTRANS_ settings to customize: