Commits

Branko Vukelic committed 99cd85d

Updated readme and bumped version

  • Participants
  • Parent commits b24847f

Comments (0)

Files changed (2)

 3. Not necessary to modify your existing models
 
 Keep in mind that this library is fairly young so it still lacks many of the
-convenience features such as automatic translation of fields and admin
-integration (features that other solutions do promise). Those features are
-still being designed and are planned for future releases.
+convenience features such as automatic translation of fields. Those features 
+are still being designed and are planned for future releases.
+
+Backwards incompatible changes
+==============================
+
+Starting with v0.0.8, unique field handling is changed. Unique fields will no
+longer be unique across all translations, but just per language. Please file a
+bug report with a description of a use case if you know of a case where this
+behavior is not desirable.
 
 Overview
 ========
         class Meta:
             source_model = 'appname.Source'
 
+Admin integration
+=================
+
+From day one, i18n-model was designed to allow conventional admin integration
+using inline admin form sets. Since the translation model is a proper model,
+this wasn't a big issue. However, this package now includes a mixin to help
+manage the form set count and max count when adding inline form sets for
+translations.
+
+Using the above example models, an admin module may look like this:
+
+    from django import admin
+    from i18n_model.admin import I18nInlineMixin
+    from .models import Source, SourceI18N
+
+    
+    class SourceI18nInline(I18nInlineMixin, admin.StackedInline):
+        model = Source
+
+
+    class SourceAdmin(admin.ModelAdmin):
+        inlines = [SourceI18nInline]
+
+
+    admin.site.register(Source, SourceAdmin)
+
+The admin inline mixin checks the source module's translations and creates
+inline formsets for missing ones. When translations exist for all languages
+listed under ``settings.LANGUAGES``, it will create no further inline forms.
+
+This feature is not tested on Django >= 1.6 yet. Please let me know if it works
+for you.
+
 Creating translations
 =====================
 
 
     translation = my_source.translations.sr().get()
 
+Getting translation languages
+=============================
+
+If you need to get a list of languages for which translations exist, you can do
+so using the ``get_available_languages()`` method. For example::
+
+    my_source.translations.get_available_languages() # >> ['sr', 'it']
+
+This has very little value under normal circumstances, and it does result in a
+database lookup, but it is used in the admin area for determining the initial
+value of form sets.
+
 Retrieving translations programmatically
 ========================================
 
 
 setup(
     name='django-i18n-model',
-    version='0.0.7',
+    version='0.0.8',
     packages=['i18n_model', 'i18n_model.templatetags'],
     license='BSD',
     author='Branko Vukelic',