deschler / django-modeltranslation

Translates Django models using a registration approach.
BSD 3-Clause "New" or "Revised" License
1.38k stars 257 forks source link

grouped fields translation is not displayed #52

Open deschler opened 12 years ago

deschler commented 12 years ago

Original author: metasov@gmail.com (November 11, 2010 07:52:01)

When grouping fields in tuple to show in one line, no translation fields are displayed, only original.

class ProperyAdmin(TranslationAdmin): models = Property fieldsets = ( (None, { 'fields':('title', ('code', 'active', 'main_page'), ('price','extra_price'), 'short_description', 'description' , 'titleimage') }), (('Advanced options'),{ 'classes': ('collapse',), 'fields': ('slug',) }) )

Quick solution is changing manually ('price','extra_price') to ('price','extra_price_lang1','extra_price_lang2')

Original issue: http://code.google.com/p/django-modeltranslation/issues/detail?id=52

deschler commented 12 years ago

From eschler on June 03, 2011 11:56:39 Support for fieldsets was added in 0.2, so your above setting should be fine.

Can you give more detail about your setup, i suppose extra_price is registered for translation? What field type is extra_price? Posting the relevant parts of your models.py and translation.py might help here.

deschler commented 12 years ago

From Maxwell....@gmail.com on August 27, 2011 11:22:55 I have the same problem.

deschler commented 12 years ago

From eschler on October 10, 2011 15:30:38 Sorry, i misread the bug report. It's about nested tuples in fieldsets, didn't even know that it was possible to group fields like this. :) Reproduced it now.

deschler commented 12 years ago

From eschler on October 10, 2011 18:48:22 This issue was closed by revision r124.

deschler commented 12 years ago

From eschler on October 10, 2011 18:53:46 The commit in r124 only resolves the issue partly. It's basically easy to fix on the normal admin site, but doing it will break the current tabs implementation, which simply isn't aware of grouped fieldsets.

Until this is adressed, the following fields definiton

'fields': ('a', ('b', 'c'))

will be handled the same way as

'fields': ('a', 'b', 'c')

and with languages 'de' and 'en' for example result in:

'fields': ('a_en', 'a_de', 'b_en', 'b_de', 'c_en', 'c_de')

deschler commented 12 years ago

From hainea...@gmail.com on October 24, 2011 14:57:54 The new fix (r124) breaks with my existing projects .. If I specify a fieldsets to my admin class it only shows the translated fields and if no fieldsets is specified it works fine.

So I had to freeze my requirements to r123.

http://code.google.com/p/django-modeltranslation/source/diff?spec=svn123&r=124&format=side&path=/trunk/modeltranslation/admin.py

deschler commented 12 years ago

From eschler on February 23, 2012 09:44:15 Reopened because of regression.

deschler commented 12 years ago

From eschler on February 23, 2012 09:56:13 I have removed the changes from r124. Unfortunately i currently don't have much time to look into the issue. Patches are welcome.

deschler commented 11 years ago

Commited a workaround in: https://github.com/deschler/django-modeltranslation/commit/ee380ec7b797df8254de84be66a7687978d968b1

The fix flattens grouped fields. Done this way, because:

  1. They are hard to handle in the jquery-ui tabs implementation
  2. They don't scale well with more than a few languages
  3. It's better than not handling them at all (okay that's weak)

I keep the ticket open, because it's not a fully satisfying fix. While it prevents existing admin pages from breaking, someone might still want fields to be displayed in same line (this is what the feature is all about).

So if we can solve 1. and assume that we don't care about 2. we should try to implement it correctly.