Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zostera/django-modeltrans
Translate Django model fields in a PostgreSQL JSONField
https://github.com/zostera/django-modeltrans
Last synced: 2 days ago
JSON representation
Translate Django model fields in a PostgreSQL JSONField
- Host: GitHub
- URL: https://github.com/zostera/django-modeltrans
- Owner: zostera
- License: bsd-3-clause
- Created: 2017-05-08T08:21:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T02:16:03.000Z (3 months ago)
- Last Synced: 2025-01-19T17:48:46.085Z (6 days ago)
- Language: Python
- Homepage: http://django-modeltrans.readthedocs.io/en/latest/
- Size: 540 KB
- Stars: 66
- Watchers: 7
- Forks: 10
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-django - django-modeltrans - Translate Django model fields in a JSONField. (Third-Party Packages / Internationalisation (i18n))
README
# django-modeltrans
[![CI](https://github.com/zostera/django-modeltrans/actions/workflows/ci.yml/badge.svg)](https://github.com/zostera/django-modeltrans/actions/workflows/ci.yml)
[![Documentation Status](https://readthedocs.org/projects/django-modeltrans/badge/?version=latest)](http://django-modeltrans.readthedocs.io/en/latest/?badge=latest)
[![Any color you like](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)Translates Django model fields in a `JSONField` using a registration approach.
# Features/requirements
- Uses one PostgreSQL `jsonb`-field per model (via `django.db.models.JSONField`)
- Django 4.2, 5.0 (with their supported python versions)
- PostgreSQL >= 13 and the appropriate `psycopg` version for your Django version
- [Available on pypi](https://pypi.python.org/pypi/django-modeltrans)
- [Documentation](http://django-modeltrans.readthedocs.io/en/latest/)# Running the tests
`tox`
Running the tests only for the current environment, use `make test`
# Attribution
Some concepts and code come from https://github.com/deschler/django-modeltranslation,
which is in turn inspired by https://github.com/zmathew/django-linguoWe started this solution at Zostera because we did not like:
- The way django-modeltranslation adds one field per language (and thus requires a migration
when adding a language);
- The unpredictability of the original field.Since `JSONB` is supported by Postgres now, we developed this approach.
# Relevant 3rd party documentation
- [PostgreSQL jsonb functions](https://www.postgresql.org/docs/9.5/static/functions-json.html)