Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional supported fields #118

Open
jacobwegner opened this issue May 10, 2024 · 1 comment
Open

Add additional supported fields #118

jacobwegner opened this issue May 10, 2024 · 1 comment

Comments

@jacobwegner
Copy link
Contributor

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.

This was referenced May 10, 2024
@jacobwegner
Copy link
Contributor Author

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:

  • The supported fields (MODELTRANS_SUPPORTED_FIELDS)
  • The TranslatedVirtualField class (which a subclass could be used to override the FileField functionality) (MODELTRANS_VIRTUAL_FIELD_CLASS)
  • The TranslationField class (which a subclass could be used to override the pre_save functionality) (MODELTRANS_TRANSLATION_FIELD_CLASS)

jieter pushed a commit that referenced this issue Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant