3

I´m developing a website with Mezzanine and I´m having problem trying to configure modelTranslation plugin for it.I´m using Django 1.8.9 and Mezzanine 4.0.1, django_modeltranslation 0.11.

I have a model class GenericContent with some fields :

class GenericContent(models.Model):
    image_footer = RichTextField(blank=True)
    video_footer = RichTextField(blank=True)
    summary = RichTextField(blank=True)

class BasicContent(Page, RichText, GenericContent):
    pass

In the translation.py file for the basicContent app, we have the following modelTranslation translation definitions :

class TranslatedGenericContent(TranslationOptions):
    fields = ('summary',
              'image_footer',
              'video_footer',)

class TranslatedBasicContent(TranslationOptions):
    pass

translator.register(GenericContent, TranslatedGenericContent)
translator.register(BasicContent, TranslatedBasicContent)

With this configuration, it doesn´t show errors, but the basicContent doesn´t get translated(the inherited fields from genericContent are registered for translation, but in basicContent they don´t get translated, nor any other fields from the parent classes[Page and RichText], which are Mezzanine included classes and registered for translation).

If I try to modify the translation.py file :

class TranslatedGenericContent(TranslationOptions):
    fields = ('summary',
              'image_footer',
              'video_footer',)

translator.register(GenericContent, TranslatedGenericContent)
translator.register(BasicContent, TranslatedGenericContent)

This other configuration gives and error when trying to run python manage.py sync_translation_fields

basicContent.BasicContent.image_footer_en: (models.E006) The field 'image_footer_en' clashes with the field 'image_footer_en' from model 'basicModels.genericcontent'.
basicContent.BasicContent.image_footer_es: (models.E006) The field 'image_footer_es' clashes with the field 'image_footer_es' from model 'basicModels.genericcontent'.
basicContent.BasicContent.summary_en: (models.E006) The field 'summary_en' clashes with the field 'summary_en' from model 'basicModels.genericcontent'.
basicContent.BasicContent.summary_es: (models.E006) The field 'summary_es' clashes with the field 'summary_es' from model 'basicModels.genericcontent'.
basicContent.BasicContent.video_footer_en: (models.E006) The field 'video_footer_en' clashes with the field 'video_footer_en' from model 'basicModels.genericcontent'.
basicContent.BasicContent.video_footer_es: (models.E006) The field 'video_footer_es' clashes with the field 'video_footer_es' from model 'basicModels.genericcontent'.

Have you ever experienced this problem? I´m looking into a fix for this. Any help would be appreciated!

Savad KP
  • 1,625
  • 3
  • 28
  • 40
lukasged
  • 198
  • 1
  • 11

0 Answers0