Compatibility improvements

Merged
#1 · Created  · Last updated

Merged pull request

Merged in egasimus/django-i18n-model (pull request #1)

a984076·Author: ·Closed by: ·2014-02-10

Description

Zdravo Branko,

Thanks for your quick response. I've made a few tweaks to the code in the meantime, so I can't really provide you with a stack trace anymore - everything just works now! Here's what I did:

  • On Python 2.7.3, I was getting a DeprecationWarning at I18nManager.__new__. I fixed that, possibly improving compatibility with Python 3, which apparently doesn't allow one to pass arguments into __new__, anyway.

  • I've taken the liberty to apply my own coding style to some function calls, lists, etc. With the limited vertical space that the current crop of widescreen monitors give us, I find any piece of code much more comprehensible when space is used more effectively.

  • I've made I18nModelMixin.model to point to the translation model and not the source model to stick with the Django paradigm for inlines. This is what I believe to have sorted out the Reversion bug, and it's likely to prevent many more compatibility in the issues.

  • It seems that Django 1.6 has introduced a get_extra method of its own, using it in place of self.extra when setting defaults in InlineModelAdmin.get_formset. It takes a request parameter before obj, though, and the clashing method signatures were giving me a nasty error. I've updated I18nInlineMixin.get_extra to match InlineModelAdmin.get_extra.

I need to add that I really like your approach to the problem of translating model fields. It was unimaginable that, if I wanted my translations stored in a separate table, I would have to wrap my head around the horrible syntax introduced by something like Hvad or Parler! A quick look at the documentation and you can kind of tell that Hvad it's a library built by, and for, Swedish vikings. :)

I've started using django-i18n-model in my job, so I think I might contribute a fair bit more in the near future. Keep up the good work!

0 attachments

0 comments

Loading commits...