Upgrade to Pro — share decks privately, control downloads, hide ads and more …

django-parler - DjangoCon EU 2014 lightning talk

django-parler - DjangoCon EU 2014 lightning talk

Extended version of my previous django-parler presentation. Explain why django-modeltranslation or django-hvad were nog used, and what complex inheritance I'd faced. Now features such as:

* Python 3 support
* Prefetching translations
* Caching
* High-level features such as `{% get_translated_url %}`.
* Admin inlines

Easily translate cheese omelet into omelette du fromage.

Diederik van der Boor

May 15, 2014
Tweet

More Decks by Diederik van der Boor

Other Decks in Programming

Transcript

  1. django-parler Easily translate cheese omelet into omelette du fromage. Diederik

    van der Boor Django Meetup 14-05-2014
  2. Simple Django model translations without nasty hacks with nice admin

    integration.
  3. Got hopeful Making a CMS multilingual: Well, let's use something

    existing...
  4. django-modeltranslation :-(

  5. django-hvad :-( Very nice admin, awesome API – however: Overrides

    just about all ORM methods! Lots of metaclass magic Mixing translated with untranslated objects = hard Can't be combined with other apps (mptt, polymorphic, shop) Doesn't call super() often
  6. django-polymorphic-tree Yes, we do crazy things...

  7. django-fluent CMS ...when they make sense

  8. 1 row for each language

  9. Let's just do this..!

  10. And tried more hacking!

  11. Package that! So we: – Hacked something directly in the

    CMS app – K.I.S.S – Manually created translated fields table – Manually assigned descriptors – Hey that works!!
  12. Model API

  13. Usage

  14. Features Python 3 qs.translated(''en'', name=''foo'') qs.prefetch_related(''translations'') {% get_translated_url ''fr'' page

    as url %} caching individual objects admin tabs + inlines
  15. None
  16. None
  17. None
  18. Thanks to caching...

  19. None
  20. None
  21. @vdboor @edoburu pip install 'django-parler>=1.0b2' https://github.com/edoburu/django-parler http://django-fluent.org