{ "info": { "author": "Jacek Tomaszewski", "author_email": "jacek.tomek@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "===============================\ndjango-modeltranslation-wrapper\n===============================\n\n.. attention::\n ``modeltranslation-0.5`` has incorporated all features from this app\n (moreover, intelligent manager has been improved), so instead of using this app, please update\n your ``modeltranslation`` version. However, this app is still provided for those who\n (for some dark reason) wish to stay with older `MT` releases.\n\nThis package is a bunch of patches for ``django-modeltranslation``\n(http://code.google.com/p/django-modeltranslation/,\nhttp://pypi.python.org/pypi/django-modeltranslation/),\nwhich can enhance usage of this nice app and target some annoying aspects.\n\nTwo features were added:\n\n* autodiscover of ``translation.py`` files within apps\n\n ``modeltranslation-0.4`` already has this feature (ported from this app :P), so it is no more\n needed here and is only left for use with older versions of ``modeltranslation``.\n Thus, the autodiscover is deactivated if the 0.4 version of ``modeltranslation`` is detected.\n\n* intelligent manager: filtering, ordering, creating and so on takes current language into\n consideration\n\n (This feature was mainly ported from ``django-linguo`` (https://github.com/zmathew/django-linguo,\n http://pypi.python.org/pypi/django-linguo),\n another good app. However, ``modeltranslation`` idea of `translation fields` registration is\n better than ``linguo`` model code edition - especially with 3rd-party apps)\n\nLater, ``modeltranslation`` will be referred as `MT`, and ``django-modeltranslation-wrapper`` as\n`Wrapper`.\n\nFeatures\n========\n\nAutodiscover\n------------\n\nThis app changes the way that the translation files are sought for. In `MT`, you have\njust one file per project. `Wrapper` makes it more like in the ``admin``: every application in\n``INSTALLED_APPS`` is examined and its ``translation.py`` is imported (if present).\n\nMoreover, if you still want to include some non-app translations (e.g. translation for 3rd-party apps),\nthere is new setting introduced: ``MODELTRANSLATION_TRANSLATION_FILES``. It should contain list of\nadditional modules (containing translations) to import.\n\nSo, when using `Wrapper`, the ``MODELTRANSLATION_TRANSLATION_REGISTRY`` setting is unnecessary.\n\nFor backward compatibility with `MT`, when ``MODELTRANSLATION_TRANSLATION_REGISTRY`` is present,\nit is treated as if it was listed in ``MODELTRANSLATION_TRANSLATION_FILES``. So no changes are\nrequired in existing projects using `MT`.\n\nIntelligent manager\n-------------------\n\n`Wrapper` changes managers in translatable models so that they are aware of active language in their\noperations. That means, unsuffixed attributes parameters are rewritten to the suffixed versions.\n\nThese statements give the same results, assuming current active language is ``pl``::\n\n X.objects.filter(foo='bar')\n X.objects.filter(foo_pl='bar')\n\n activate('de')\n X.objects.filter(foo_pl='bar') # Still the same result\n\nIf the translatable model has own custom manager, intelligent manager will be gently added,\nretaining old functions.\n\nThe ``X.objects.create()`` is special case, however. For backward compatibility it works as in `MT` by\ndefault. But you can pass parameter ``_populate=True`` to populate suffixed fields with\nvalues from unsuffixed ones.\n\nExample will clarify it::\n\n x = X.objects.create(foo='bar', _populate=True)\n\nis equivalent of::\n\n x = X.objects.create(foo_en='bar', foo_pl='bar', ... , foo_zu='bar')\n\nor::\n\n x = X.objects.create(foo='bar')\n x.foo_en = 'bar'\n x.foo_pl = 'bar'\n ...\n x.foo_zu = 'bar'\n x.save()\n\nMoreover, some field can be explicitly assigned different value::\n\n x = X.objects.create(foo='-- no translation yet --', foo_pl='nic', _populate=True)\n\nIt will result in ``foo_pl == 'nic'`` and other ``foo_?? == '-- no translation yet --'``.\n\nThere is more convenient way than passing ``_populate`` all the time:\n``MODELTRANSLATION_AUTO_POPULATE`` setting. If ``_populate`` parameter is missing, ``create()`` will\nlook at the setting to determine if population should be used.\n\nThis useful feature is disabled by default for backward compatibility with `MT` tests.\nHowever, if your code doesn't heavily rely on the fact that ``create()`` set None on suffixed fields,\nit is advised to set ``MODELTRANSLATION_AUTO_POPULATE = True``.\n\nNew settings\n------------\n\nMODELTRANSLATION_TRANSLATION_FILES\n Default: ``()``\n\n List of additional translation modules to import.\n\nMODELTRANSLATION_AUTO_POPULATE\n Default: ``False``\n\n This setting control if ``X.objects.create()`` function should populate language fields\n values.\n\n\nInstallation\n============\n\n1. Install app::\n\n $ pip install django-modeltranslation-wrapper\n\n or download it manually and put in python path.\n\n#. Add ``modeltranslation_wrapper`` to ``INSTALLED_APPS`` **before** plain ``modeltranslation``::\n\n INSTALLED_APPS = (\n ...\n 'modeltranslation_wrapper',\n 'modeltranslation',\n ...\n )\n\n#. Optionally, specify ``MODELTRANSLATION_TRANSLATION_FILES`` in settings::\n\n MODELTRANSLATION_TRANSLATION_FILES = (\n 'myproject.flatpages_translation',\n 'myproject.foo_translation',\n )\n\n These modules will be imported in addition to autodiscovered ones.\n\n#. If you are using `MT` in version 0.4 or newer, unfortunatelly you must also add\n ``'modeltranslation_wrapper.patch'`` as last entry in ``MODELTRANSLATION_TRANSLATION_FILES``\n to enable inteligent manager::\n\n MODELTRANSLATION_TRANSLATION_FILES = (\n 'myproject.flatpages_translation',\n 'myproject.foo_translation',\n 'modeltranslation_wrapper.patch',\n )\n\n This is caused by change in the way `MT` 0.4 loads translations.\n\n#. Optionally, specify ``MODELTRANSLATION_AUTO_POPULATE`` (see above)::\n\n MODELTRANSLATION_AUTO_POPULATE = True\n\n----------\n\nChangelog\n=========\n\n**1.2.2** (04/03/2012)\n Repacked distribution to remove obsolete ``modeltranslations`` package, which was previously added by accident.\n\n**1.2.1** (23/09/2012)\n - Refactor code to work with modeltranslation-0.4\n - Update MultilingualManager to rewrite Q nad F queries\n\n**1.1** (04/09/2012)\n Added testrunner\n\n**1.0** (24/06/2012)\n Initial code\n\n:Authors: Jacek Tomaszewski\n\n Zach Mathew (of ``django-linguo``)\n\n For details see AUTHORS file.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zlorf/django-modeltranslation-wrapper", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-modeltranslation-wrapper", "package_url": "https://pypi.org/project/django-modeltranslation-wrapper/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-modeltranslation-wrapper/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/zlorf/django-modeltranslation-wrapper" }, "release_url": "https://pypi.org/project/django-modeltranslation-wrapper/1.2.2/", "requires_dist": null, "requires_python": null, "summary": "Wrapper around modeltranslation package, adding nice features.", "version": "1.2.2" }, "last_serial": 738684, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "08762f9e53390b0ae3654cd90abe66c1", "sha256": "d3cc53a3d23ab23fa8096fb4bce5712a085358d1732eef5418bb1640b866d402" }, "downloads": -1, "filename": "django-modeltranslation-wrapper-1.0.tar.gz", "has_sig": false, "md5_digest": "08762f9e53390b0ae3654cd90abe66c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10592, "upload_time": "2012-06-24T14:02:00", "url": "https://files.pythonhosted.org/packages/4a/d6/b37e5e3354634932fee75caffa5afeacb74500cd166c01987e68d16f158c/django-modeltranslation-wrapper-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "bfb172c1b42ac381892e57f1b3a114ab", "sha256": "9d2e5a9a60018445c02ca1bb683a595c1a6c5363c8b9c28981fe33c4de8a18a7" }, "downloads": -1, "filename": "django-modeltranslation-wrapper-1.1.tar.gz", "has_sig": false, "md5_digest": "bfb172c1b42ac381892e57f1b3a114ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10883, "upload_time": "2012-09-04T12:22:48", "url": "https://files.pythonhosted.org/packages/09/42/5346797e9834bcb041ec22f6f5893558e344f4c4bc684d8978424470cbe6/django-modeltranslation-wrapper-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "32417795a0d8d78343337d02788f51f5", "sha256": "2ca7bf06f1afad328dc87a745206b5d3f3130de46848cf8b88093865bce5b932" }, "downloads": -1, "filename": "django-modeltranslation-wrapper-1.2.tar.gz", "has_sig": false, "md5_digest": "32417795a0d8d78343337d02788f51f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23758, "upload_time": "2012-10-13T11:03:54", "url": "https://files.pythonhosted.org/packages/1b/6f/100eda3a8e4f3107d62844f2af3b52c982d32899941c2277074a60dbfd7d/django-modeltranslation-wrapper-1.2.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "5cfcef612e5e95463e18d727710aa26a", "sha256": "b513226b4a3eb63ad3a369df77c3bb5ceccecd63df550bf76ebe49415ce1a531" }, "downloads": -1, "filename": "django-modeltranslation-wrapper-1.2.1.tar.gz", "has_sig": false, "md5_digest": "5cfcef612e5e95463e18d727710aa26a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22490, "upload_time": "2012-10-13T19:38:04", "url": "https://files.pythonhosted.org/packages/7b/74/427641b73226c4f4303a78f89b1ae08cda4bdbcc7f65ae3539ae7a7abd2c/django-modeltranslation-wrapper-1.2.1.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "eae3b6db18b045f3634c0edb2a2f1d73", "sha256": "ff0f0f5c41384f3dbb2b021dfba794a18f81ffd422a80fef56ab2a542f1abf4d" }, "downloads": -1, "filename": "django-modeltranslation-wrapper-1.2.2.tar.gz", "has_sig": false, "md5_digest": "eae3b6db18b045f3634c0edb2a2f1d73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12747, "upload_time": "2013-03-04T11:23:00", "url": "https://files.pythonhosted.org/packages/c4/6b/d6e89e9e2f1188ebe75eb53af86d6311cd44a1fdf1aa96d94b2affe1fff8/django-modeltranslation-wrapper-1.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eae3b6db18b045f3634c0edb2a2f1d73", "sha256": "ff0f0f5c41384f3dbb2b021dfba794a18f81ffd422a80fef56ab2a542f1abf4d" }, "downloads": -1, "filename": "django-modeltranslation-wrapper-1.2.2.tar.gz", "has_sig": false, "md5_digest": "eae3b6db18b045f3634c0edb2a2f1d73", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12747, "upload_time": "2013-03-04T11:23:00", "url": "https://files.pythonhosted.org/packages/c4/6b/d6e89e9e2f1188ebe75eb53af86d6311cd44a1fdf1aa96d94b2affe1fff8/django-modeltranslation-wrapper-1.2.2.tar.gz" } ] }