{ "info": { "author": "Mathijs de Bruin", "author_email": "mathijs@mathijsfietst.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3" ], "description": "=========================\ndjango-multilingual-model\n=========================\n\n.. image:: https://secure.travis-ci.org/dokterbob/django-multilingual-model.png?branch=master\n :target: http://travis-ci.org/dokterbob/django-multilingual-model\n\nDjango Simple Multilingual Support for models\n---------------------------------------------\n\nWhat is it?\n===========\nAn inefficient, minimal and utterly simple approach to model translation based\non foreign key relations and attribute proxying.\n\nThe project code is forked from the\n`original project `_ by\nyazzgoth on Google code.\n\nUsage\n=====\nWhen a property of a translation is set for the language currently selected\nin this thread, it will automatically yield the right value of that property\nfor the current language. So for a book which has a tranlation in `en`,\nrequesting `book.title` from within a template from a client of which the\ndetected language is English, will simply yield the English translation of the\nbook title.\n\n\nmodels.py::\n\n\tfrom multilingual_model.models import MultilingualModel, MultilingualTranslation\n\n\tclass BookTranslation(MultilingualTranslation):\n\t class Meta:\n\t unique_together = ('parent', 'language_code')\n\n\t parent = models.ForeignKey('Book', related_name='translations')\n\n\t title = models.CharField(max_length=32)\n\t description = models.TextField()\n\n\tclass Book(MultilingualModel):\n\t ISBN = models.IntegerField()\n\n\n\t>>> book = Book(ISBN=\"1234567890\")\n\t>>> book.save()\n\t>>> book_en = BookTranslation(language_code='en')\n\t>>> book_en.title = \"Django for Dummies\"\n\t>>> book_en.description = \"Django described in simple words.\"\n\t>>> book_en.parent = book\n\t>>> book_en.save()\n\t>>> book_pl = BookTranslation(language_code='pl')\n\t>>> book_pl.title = \"Django dla Idiotow\"\n\t>>> book_pl.description = \"Django opisane w prostych slowach\"\n\t>>> book_pl.parent = book\n\t>>> book_pl.save()\n\t>>> # now here comes the magic\n\t>>> book.title_en\n\tu'Django for Dummies'\n\t>>> book.description_pl\n\tu'Django opisane w prostych slowach'\n\nCompatibility\n=============\nCurrently Django 1.4 through 1.6 is maintained for Python 2.6, 2.7 and 3.3.\n\nAdmin integration\n=================\n\nadmin.py::\n\n\tfrom django.contrib import admin\n\timport models\n\n\tfrom multilingual_model.admin import TranslationStackedInline\n\n\n\tclass BookTranslationInline(TranslationStackedInline):\n\t model = models.BookTranslation\n\n\tclass BookAdmin(admin.ModelAdmin):\n\t list_display = [\"ISBN\"]\n\t inlines = [BookTranslationInline]\n\n\tadmin.site.register(models.Book, BookAdmin)\n\n\n`__unicode__` representation using translated field\n===================================================\nIn order to make translation of the `__unicode__` function work, some magic\nis required. A helper method for this is included by default, allowing you to do the following::\n\n\tdef __unicode__(self):\n\t return self.unicode_wrapper('title', default='Unnamed')\n\nUpgrade from previous versions\n==============================\nIf you upgrade from previous versions you need to be aware of two important facts:\n\n1. The Model MultilingualTranslation in multilingual_model.models has a field\n named \"language_code\". In prior versions the max_length was set to 5. This has\n been changed to 7 to allow longer language codes to be valid. This\n could break validation in certain situations. A way to reflect this change on\n the level of the database is to manually change the database table of the models\n that are translated.\n2. In admin.py the class TranslationInline has been renamed to\n TranslationStackedInline. TranslationInline will be deprecated soon. Additionally\n to TranslationStackedInline there now is a TranslationTabularInline.\n\nSettings\n========\n`MULTILINGUAL_FAIL_SILENTLY`\n\tReturn `None` instead of raising a `ValueError` when a translation for the\n\tcurrent language cannot be found and `MULTILINGUAL_FALL_BACK_TO_DEFAULT` is\n\t`False`. Defaults to the inverse of `DEBUG`.\n\n`MULTILINGUAL_FALL_BACK_TO_DEFAULT`\n\tWhether or not to fall back to `MULTILINGUAL_LANGUAGE_CODE` when no translation\n\tcan be found for the currently activated language. Defaults to `True`.\n\n`MULTILINGUAL_LANGUAGE_CODE`\n\tThe default language used when `MULTILINGUAL_FALL_BACK_TO_DEFAULT` is `True`.\n\tDefaults to `LANGUAGE_CODE`.\n\n`MULTILINGUAL_LANGUAGES`\n\tSet of languages available for translation. Defaults to `LANGUAGES`.\n\n`MULTILINGUAL_HIDE_LANGUAGE`\n\tHide functionality for selecting the language and removing translations in the admin.\n\tDefaults to `True` when `MULTILINGUAL_LANGUAGES` contains of a single language.\n\nLicense\n=======\nThis application is released under the GNU Affero General Public License version 3.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/dokterbob/django-multilingual-model", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-multilingual-model", "package_url": "https://pypi.org/project/django-multilingual-model/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-multilingual-model/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/dokterbob/django-multilingual-model" }, "release_url": "https://pypi.org/project/django-multilingual-model/0.6/", "requires_dist": null, "requires_python": null, "summary": "Django Simple Multilingual Support for Models.", "version": "0.6" }, "last_serial": 1077709, "releases": { "0.5": [ { "comment_text": "", "digests": { "md5": "901a1f8dc3bb450847824d018b4eafc2", "sha256": "c23297dfc91ce81371b827e55731ac814efd47573fc9f63c44a8230a2e1c289b" }, "downloads": -1, "filename": "django-multilingual-model-0.5.tar.gz", "has_sig": false, "md5_digest": "901a1f8dc3bb450847824d018b4eafc2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9599, "upload_time": "2013-09-03T10:29:39", "url": "https://files.pythonhosted.org/packages/83/77/2d27bd694b594275048d3f6dfb3dfd212998486e3010efe7f0c4808b5735/django-multilingual-model-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "7da1ff35bd57d6154614ca73dda2df0d", "sha256": "2c3727ad6d797c198a79a2ecc1243eb61d71091d714f6d20441c39136b1ffd0a" }, "downloads": -1, "filename": "django-multilingual-model-0.5.1.tar.gz", "has_sig": false, "md5_digest": "7da1ff35bd57d6154614ca73dda2df0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21793, "upload_time": "2013-09-11T11:21:00", "url": "https://files.pythonhosted.org/packages/da/22/eb1dfa592616fb9ecd62b7264db924f7819aebf0a16bd75e67201040bc5b/django-multilingual-model-0.5.1.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "87a63b87d3eaf74c891cc28c02e941fa", "sha256": "35c17bb70d885125b5f4a407d26d6b8cc2decaf0244493f5a695804f32f1097d" }, "downloads": -1, "filename": "django_multilingual_model-0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "87a63b87d3eaf74c891cc28c02e941fa", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 12696, "upload_time": "2014-05-01T13:35:37", "url": "https://files.pythonhosted.org/packages/24/bc/534f8f9387b471229954166ed4f2e1c31fbbd0f135ebaf9ef1126a77a714/django_multilingual_model-0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7c00536ab0e89d2d19562c537db96ac0", "sha256": "b7b2057c4d9abcda77190fdb58b15d940e7838100a524b298681ea98b5c94bbb" }, "downloads": -1, "filename": "django-multilingual-model-0.6.tar.gz", "has_sig": false, "md5_digest": "7c00536ab0e89d2d19562c537db96ac0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21955, "upload_time": "2014-05-01T13:35:35", "url": "https://files.pythonhosted.org/packages/6c/09/ff01f514ea1aba703962eb05f38ce1bc92f1d7df1dfd008f81da7cef866f/django-multilingual-model-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "87a63b87d3eaf74c891cc28c02e941fa", "sha256": "35c17bb70d885125b5f4a407d26d6b8cc2decaf0244493f5a695804f32f1097d" }, "downloads": -1, "filename": "django_multilingual_model-0.6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "87a63b87d3eaf74c891cc28c02e941fa", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 12696, "upload_time": "2014-05-01T13:35:37", "url": "https://files.pythonhosted.org/packages/24/bc/534f8f9387b471229954166ed4f2e1c31fbbd0f135ebaf9ef1126a77a714/django_multilingual_model-0.6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7c00536ab0e89d2d19562c537db96ac0", "sha256": "b7b2057c4d9abcda77190fdb58b15d940e7838100a524b298681ea98b5c94bbb" }, "downloads": -1, "filename": "django-multilingual-model-0.6.tar.gz", "has_sig": false, "md5_digest": "7c00536ab0e89d2d19562c537db96ac0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21955, "upload_time": "2014-05-01T13:35:35", "url": "https://files.pythonhosted.org/packages/6c/09/ff01f514ea1aba703962eb05f38ce1bc92f1d7df1dfd008f81da7cef866f/django-multilingual-model-0.6.tar.gz" } ] }