Store internationalized strings in Django models
Project description
This is yet another way to store multi-lingual content in Django. In contrast to other options like django-hvad, django-modeltranslation or django-parler it does not require additonal database tables and you can reconfigure the available languages without any changes to the database schema. In constrast to nece, it is not specific to PostgreSQL.
How does it work then? It stores JSON data into a TextField. Yes, this is kinda dirty and violates the 1NF. This makes it harder for non-django based programs to interact directly with your database and is not perfectly efficient in terms of storage space. It also lacks the ability to do useful lookups, searches and indices on internationalized fields. If one of those things are important to you, this project is not for you, please choose one of the ones that we linked above.
However if those limitations are fine for you, this provides you with a very lightweight, easy to use and flexible solution. This approach has been in use in pretix for quite a while, so it has been tested in production. The package contains not only the model fields, but also form fields and everything you need to get them running.
Features
Very easy installation
Internationalized versions of CharField and TextField types
Integrated form fields types and widgets
Automatic migration from non-localized fields with a simple migration
Full support for forms and formsets
Possibility to dynamically limit the displayed languages
Very basic integration with django admin
Integration with Django Restframework
Comprehensive test suite and production-tested
Tested with:
Python 3.6 to 3.10
Django 3.2 to 4.0
License
The code in this repository is published under the terms of the Apache License. See the LICENSE file for the complete license text.
This project is maintained by Raphael Michel <mail@raphaelmichel.de>. See the AUTHORS file for a list of all the awesome folks who contributed to this project.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-i18nfield-1.9.4.tar.gz
.
File metadata
- Download URL: django-i18nfield-1.9.4.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f24c209f4fcbf407ec1ebf749b6c182bf4089ef46c3cd0e60fa547955d575d2e |
|
MD5 | 962a64bc14f230b75e9349e7a73a9fcd |
|
BLAKE2b-256 | 4916663d4708d7bd517b08d4e83426c01e8571fd9f7b09ef8602b50a01eca6aa |
File details
Details for the file django_i18nfield-1.9.4-py3-none-any.whl
.
File metadata
- Download URL: django_i18nfield-1.9.4-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d31bf725b43d6fa0d67a403efb45abf54fc6013ee9135ad55679626df9d0c8ca |
|
MD5 | 265a9dc5223f3d1b0b8415d358cc92a3 |
|
BLAKE2b-256 | 504fab4e16ce934a09b3078a9402ef8303f036c703db95f504d2f8f9cdedb84d |