Skip to main content

Store internationalized strings in Django models

Project description

https://img.shields.io/pypi/v/django-i18nfield.svg https://readthedocs.org/projects/django-i18nfield/badge/?version=latest https://travis-ci.org/raphaelm/django-i18nfield.svg?branch=master https://codecov.io/gh/raphaelm/django-i18nfield/branch/master/graph/badge.svg

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

Compatible with:

  • Python 3.4 to 3.7

  • Django 1.11 to 2.2

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


Download files

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

Source Distribution

django-i18nfield-1.5.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

django_i18nfield-1.5.1-py3.6.egg (20.4 kB view details)

Uploaded Egg

django_i18nfield-1.5.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file django-i18nfield-1.5.1.tar.gz.

File metadata

  • Download URL: django-i18nfield-1.5.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6

File hashes

Hashes for django-i18nfield-1.5.1.tar.gz
Algorithm Hash digest
SHA256 96dd85b514146fd357be7864a330b8d10ed551e97b1bc0de1da9f858865e422b
MD5 cbc6fd7e8bdfdebe1ad52328cb755e1d
BLAKE2b-256 270f63afbb834529f0eadd1640d1ec315b4f6c87f4b1e75915b2bcb63a0f2d0a

See more details on using hashes here.

File details

Details for the file django_i18nfield-1.5.1-py3.6.egg.

File metadata

  • Download URL: django_i18nfield-1.5.1-py3.6.egg
  • Upload date:
  • Size: 20.4 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for django_i18nfield-1.5.1-py3.6.egg
Algorithm Hash digest
SHA256 d2589b76b5b22ff4f61b05135f36c23aed7bad71a4577eeb234b66b12333f2dc
MD5 f447d02b8f4c160a2ccdf68329c2f57c
BLAKE2b-256 a8ea3f287a485d49ba8395fc23221d3644beb3ec4f0cc7df4de2687927c84adb

See more details on using hashes here.

File details

Details for the file django_i18nfield-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: django_i18nfield-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.13.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.6

File hashes

Hashes for django_i18nfield-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49c4fd3c5d12346e52bef71778664384d5fa2dcbfd429bb30c911c391c06789a
MD5 7dd9d2a69216b5a589315afa44df215c
BLAKE2b-256 e8f4551dd3cd660eca324c4d0c98514c266dfa35da6faac478a402f13a068528

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page