Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Store internationalized strings in Django models

Project description

https://readthedocs.org/projects/django-i18nfield/badge/?version=latest https://travis-ci.org/raphaelm/django-i18nfield.svg?branch=master

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.4 to 3.6
  • Django 1.9 to 1.11

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

This version
History Node

1.3.0

History Node

1.2.1

History Node

1.2.0

History Node

1.1.1

History Node

1.1.0

History Node

1.0.1

History Node

1.0.0

History Node

1.0.0rc1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django_i18nfield-1.3.0-py3-none-any.whl (11.6 kB) Copy SHA256 hash SHA256 Wheel 3.4 Nov 20, 2017
django-i18nfield-1.3.0.tar.gz (7.9 kB) Copy SHA256 hash SHA256 Source None Nov 20, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page