django-model-i18n 0.4.2

A Django application that tries to make multilingual data in models less painful

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
BSD License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Gonzalo Saavedra, Matias Aguirre and J...
HOMEPAGE:
github.com
CATEGORY:
ROOT \ Internet \ HTTP (WWW)
django-model-i18n is a Django app that tries to make multilingual data in models less painful.

Installation

* cloning repository

Configuration

Go to urls.py into root project directory and put this

    from model_i18n import loaders

    loaders.autodiscover_admin()


also add 'django.middleware.locale.LocaleMiddleware' into MIDDLEWARE_CLASSES::

    MIDDLEWARE_CLASSES = (
        'django.middleware.common.CommonMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',
        ## IF CACHE MIDDLEWARE IS SETTING PUT HERE
        'django.middleware.locale.LocaleMiddleware',
        'django.middleware.csrf.CsrfViewMiddleware',
        'django.contrib.auth.middleware.AuthenticationMiddleware',
        'django.contrib.messages.middleware.MessageMiddleware',
        'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
    )

and finally put in INSTALLED_APPS::

    INSTALLED_APPS = (
        'model_i18n',
        ...
        'django.contrib.admin',
        ...
    )


**When putting model_i18n must be first in the list of INSTALLED_APPS.**

Usage

1) In the directory of the application create a translations.py
2) Inside the file you need to register translations like this example::

    from model_i18n import translator
    from app.models import Item

    class ItemTranslation(translator.ModelTranslation):
        fields = ('title',)

    translator.register(Item, ItemTranslation)

Last updated on August 16th, 2012

feature list requirements

#multilingual data #Django models #Django #models #i18n #multilingual

Add your review!

SUBMIT