Hi!

I'm running a simple multilingual site under Mezzanine CMS. Everything was 
fine when I was using Mezzanine==3.1.10 and Django==1.6.8. But after 
upgrade to Mezzanine==4.0.1 and Django==1.8.3 I get an error when trying to 
run ./manage.py with any command.
The error is 
./manage.py 
update_translation_fields                                                   
Traceback (most recent call 
last):                                                                          
                    

  File "manage.py", line 29, in 
<module>                                                                        
                

    
execute_from_command_line(sys.argv)                                             
                                            

  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 338, in 
execute_from_command_line                                                       
                                                        

    
utility.execute()                                                               
                                            

  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py",
 
line 312, in execute 
    
django.setup()                                                                  
                                            

  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/django/__init__.py",
 
line 18, in setup                    
    
apps.populate(settings.INSTALLED_APPS)                                          
                                            

  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/django/apps/registry.py",
 
line 115, in populate           
    
app_config.ready()                                                              
                                            

  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/modeltranslation/apps.py",
 
line 11, in ready              
    
handle_translation_registrations()                                              
                                            

  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/modeltranslation/models.py",
 
line 81, in handle_translation_registrations
    autodiscover()
  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/modeltranslation/models.py",
 
line 32, in autodiscover
    import_module(module)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/elias/FIBREOPTIC/fibre_theme/translation.py", line 50, in 
<module>
    translator.register(Page, PageTranslationOptions)
  File 
"/home/elias/FIBREOPTIC/venv/local/lib/python2.7/site-packages/modeltranslation/translator.py",
 
line 399, in register
    model.__name__)
modeltranslation.translator.AlreadyRegistered: Model "Page" is already 
registered for translation

i use standard Mezzanine models. My translation.py file is 

from modeltranslation.translator import translator, TranslationOptions
from mezzanine.pages.models import Page, RichTextPage, Link
from mezzanine.forms.models import Form, Field

class FormFieldTO(TranslationOptions):
    fields = (
        'label',
        'default',
        'placeholder_text',
        'choices',
        'placeholder_text',
        'help_text',
    )

class FormTO(TranslationOptions):
    fields = (
        'response',
        'content',
        'button_text',
    )

class PageTranslationOptions(TranslationOptions):
    fields = (
        'title',
        # 'description',
    )
    required_languages = (
        'ru',
    )

class RichPageTranslationOptions(TranslationOptions):
    fields = (
        'content',
    )
    required_languages = (
        'ru',
    )

class LinkTranslationOptions(TranslationOptions):
    pass

translator.register(Page, PageTranslationOptions)
translator.register(RichTextPage, RichPageTranslationOptions)
translator.register(Form, FormTO)
translator.register(Link, LinkTranslationOptions)
translator.register(Field, FormFieldTO)

Using a trick from 
http://mezzanine.jupo.org/docs/multi-lingual-sites.html#translation-fields-and-migrations
 
won't help. After switching to USE_MODELTRANSLATION = False and running 

python manage.py makemigrations

I get an error:

modeltranslation.translator.NotRegistered: The model "Page" is not 
registered for translation

Lines from settings.py related to mulilingual support are:

LANGUAGES = (
    ('ru', gettext('Russian')),
    ('en', gettext('English')),
)

USE_MODELTRANSLATION = True
MODELTRANSLATION_DEFAULT_LANGUAGE = 'ru'

...
INSTALLED_APPS = (
#    "south",
    "modeltranslation",
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.redirects",
    "django.contrib.sessions",
    "django.contrib.sites",
    "django.contrib.sitemaps",
    "django.contrib.staticfiles",
    "mezzanine.boot",
    "mezzanine.conf",
    "mezzanine.core",
    "mezzanine.generic",
    "mezzanine.blog",
    "mezzanine.pages",
    "mezzanine.forms",
    "mezzanine.galleries",
    "mezzanine.twitter",
    "fibre_theme",
    #"mezzanine.accounts",
    #"mezzanine.mobile",
)

Thanks in advance for any help!

Ilya


-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to