mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-05-10 14:24:44 +00:00
Added Python/Django requirements to docs, plus some additional minor improvements.
This commit is contained in:
parent
9fba4bcac9
commit
9cf672f65f
2 changed files with 25 additions and 12 deletions
|
|
@ -7,12 +7,13 @@ In order to be able to edit the translations via the ``django.contrib.admin``
|
|||
application you need to register a special admin class for the translated
|
||||
models. The admin class must derive from
|
||||
``modeltranslation.admin.TranslationAdmin`` which does some funky
|
||||
patching on all your models registered for translation. Taken the news example
|
||||
the most simple case would look like:
|
||||
patching on all your models registered for translation. Taken the
|
||||
:ref:`news example <registration>` the most simple case would look like:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django.contrib import admin
|
||||
from news.models import News
|
||||
from modeltranslation.admin import TranslationAdmin
|
||||
|
||||
class NewsAdmin(TranslationAdmin):
|
||||
|
|
|
|||
|
|
@ -3,6 +3,18 @@
|
|||
Installation
|
||||
============
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
+------------------+------------+-----------+
|
||||
| Modeltranslation | Python | Django |
|
||||
+==================+============+===========+
|
||||
| >=0.4 | 2.5 - 2-7 | 1.3 - 1.4 |
|
||||
+------------------+------------+-----------+
|
||||
| <=0.3 | 2.4 - 2.7 | 1.0 - 1.4 |
|
||||
+------------------+------------+-----------+
|
||||
|
||||
|
||||
Using Pip
|
||||
---------
|
||||
|
||||
|
|
@ -97,10 +109,10 @@ and ``en`` in your project, set the ``LANGUAGES`` variable like this (where
|
|||
('en', gettext('English')),
|
||||
)
|
||||
|
||||
Note that the ``gettext`` lambda function is not a feature of the
|
||||
modeltranslation app, but rather required for Django to be able to
|
||||
(statically) translate the verbose names of the languages using the standard
|
||||
``i18n`` solution.
|
||||
.. note::
|
||||
The ``gettext`` lambda function is not a feature of modeltranslation, but
|
||||
rather required for Django to be able to (statically) translate the verbose
|
||||
names of the languages using the standard ``i18n`` solution.
|
||||
|
||||
|
||||
Advanced Settings
|
||||
|
|
@ -183,7 +195,7 @@ Support for ``FileField`` and ``ImageField``.
|
|||
In most cases subclasses of the supported fields will work fine, too. Other
|
||||
fields aren't supported and will throw an ``ImproperlyConfigured`` exception.
|
||||
|
||||
The list of supported fields can be extended. Just define a tuple of field
|
||||
The list of supported fields can be extended by defining a tuple of field
|
||||
names in your ``settings.py``.
|
||||
|
||||
Example:
|
||||
|
|
@ -192,11 +204,11 @@ Example:
|
|||
|
||||
MODELTRANSLATION_CUSTOM_FIELDS = ('MyField', 'MyOtherField',)
|
||||
|
||||
.. note:: This just prevents modeltranslation from throwing an
|
||||
``ImproperlyConfigured`` exception. Any non text-like field will most
|
||||
likely fail in one way or another. The feature is considered
|
||||
experimental and might be replaced by a more sophisticated mechanism
|
||||
in future versions.
|
||||
.. warning::
|
||||
This just prevents modeltranslation from throwing an
|
||||
``ImproperlyConfigured`` exception. Any non text-like field will most
|
||||
likely fail in one way or another. The feature is considered experimental
|
||||
and might be replaced by a more sophisticated mechanism in future versions.
|
||||
|
||||
|
||||
``MODELTRANSLATION_DEBUG``
|
||||
|
|
|
|||
Loading…
Reference in a new issue