django-parlor

Django model translations with even less nasty hacks.
git clone https://git.ce9e.org/django-parlor.git

commit
cf0f463831c86afc72b6d13d1d633836fb07c801
parent
fa2cbdfe24adc6b5f4e5e42c042663904ff25d96
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-08-06 14:04
expand usage example

Diffstat

M README.md 7 +++++++

1 files changed, 7 insertions, 0 deletions


diff --git a/README.md b/README.md

@@ -25,6 +25,8 @@ class MyModel(TranslatableModel):
   25    25 class MyModelTranslation(model.Model):
   26    26     parent = MyModel.get_parent_field()
   27    27     language_code = MyModel.get_lang_field()
   -1    28 
   -1    29     label = models.CharField(max_length=32)
   28    30     ...
   29    31 
   30    32     class Meta:
@@ -32,6 +34,11 @@ class MyModelTranslation(model.Model):
   32    34 
   33    35 
   34    36 admin.site.register(MyModel, TranslatableAdmin)
   -1    37 
   -1    38 animal = MyModel.objects.create()
   -1    39 animal.translations.create(language_code='en', label='Frog')
   -1    40 animal.translations.create(language_code='de', label='Frosch')
   -1    41 print(animal.label)
   35    42 ```
   36    43 
   37    44 ## Status