google-code-export / django-modeltranslation

Automatically exported from code.google.com/p/django-modeltranslation
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

update_translation_fields raise _mysql_exceptions.OperationalError #65

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. Copy modeltranlation into project
2. Setup all
3. Try manage.py update_translation_fields 

For already synced model

_mysql_exceptions.OperationalError: (1054, "Unknown column 
'bbs_category.name_ru' in 'where clause'")

But 'name_ru' column does not exist in table (ofcourse).

Django 1.3
django-modeltranslation 0.3.2

Original issue reported on code.google.com by qnub...@gmail.com on 4 Sep 2011 at 5:35

GoogleCodeExporter commented 9 years ago
maybe 54 issue the same. try to rename 'name' field

Original comment by qnub...@gmail.com on 5 Sep 2011 at 6:24

GoogleCodeExporter commented 9 years ago
when i run south command:

schemaigration --auto myapp 

migration with new translation fields has been maked automatically and that 
field has been added to DB with

migration myapp

south command...

Original comment by qnub...@gmail.com on 5 Sep 2011 at 8:43

GoogleCodeExporter commented 9 years ago
after that i try to check admin - they say that my model isn't registered in 
modeltranlation...

Original comment by qnub...@gmail.com on 5 Sep 2011 at 3:25

GoogleCodeExporter commented 9 years ago
  File "/usr/local/lib/python2.7/dist-packages/modeltranslation/translator.py", line 236, in get_options_for_model
    'translation' % model.__name__)
modeltranslation.translator.NotRegistered: The model "Category" is not 
registered for translation

Original comment by qnub...@gmail.com on 5 Sep 2011 at 3:30

GoogleCodeExporter commented 9 years ago
i've try to debug and i see what translator.register(models.Category, 
CategoryTranslationOptions) in my translation.py isn't call for TranslationAdmin

Original comment by qnub...@gmail.com on 5 Sep 2011 at 5:35

GoogleCodeExporter commented 9 years ago
on 

modeltranslation/models.py 

in 

__import__(TRANSLATION_REGISTRY, {}, {}, ['']) 

i have raised error 

modeltranslation.translator.NotRegistered

not ImportError

Original comment by qnub...@gmail.com on 6 Sep 2011 at 8:57

GoogleCodeExporter commented 9 years ago
'modeltranslation.translator.NotRegistered' error has been fixed when i move 
admin class from models.py to admin.py :) translator can't register model for 
admin class from same file.

'Unknown column' error still exists but fixed by 'south' using

Original comment by qnub...@gmail.com on 8 Sep 2011 at 2:35

GoogleCodeExporter commented 9 years ago
Modeltranslation doesn't make schema changes itself. As you have figured out 
yourself, you have to add the translation fields manually (unless you drop the 
table and run syncdb) or use a schema migration app like South.

Regarding the admin class in models.py - yes - you have to put it into 
admin.py. ;)

Original comment by eschler on 10 Oct 2011 at 7:05