Ticket #136 (closed defect: wontfix)

Opened 5 years ago

Last modified 5 years ago

south doesn't like django-multilingual

Reported by: anonymous Owned by: andrew
Priority: major Milestone:
Component: commands Version: 0.6-pre
Keywords: Cc: patrick.lauber@…



Traceback (most recent call last):

File "../", line 11, in <module>


File "/Users/patricklauber/Documents/workspace/django/django/core/management/", line 340, in execute_manager


File "/Users/patricklauber/Documents/workspace/django/django/core/management/", line 295, in execute


File "/Users/patricklauber/Documents/workspace/django/django/core/management/", line 192, in run_from_argv

self.execute(*args, options.dict)

File "/Users/patricklauber/Documents/workspace/django/django/core/management/", line 219, in execute

output = self.handle(*args, options)

File "/Users/patricklauber/Documents/workspace/dlib/python/py2/south/management/commands/", line 544, in handle

all_models[model_key(model)] = prep_for_freeze(model, last_models)

File "/Users/patricklauber/Documents/workspace/dlib/python/py2/south/management/commands/", line 586, in prep_for_freeze

fields = modelsparser.get_model_fields(model, m2m=True)

File "/Users/patricklauber/Documents/workspace/dlib/python/py2/south/", line 311, in get_model_fields

raise ValueError?("Cannot find source for model '%s'." % model)

ValueError?: Cannot find source for model '<class 'links.models.LinkTranslation?'>'.

If a field is makred as translateable mit django-multilingual south gives the above error

Attachments (14.4 KB) - added by neeleshs@… 5 years ago. See get_model_tree(..)

Change History

comment:1 Changed 5 years ago by Erik Allik <eallik@…>

Just as a side note: I don't think django-multilingual is a good thing to use, it's too magical. Therefore I don't think South should really handle django-multilingual.

For a workaround, see how multilingualism is done in Satchmo (it's an e-commerce solution written in Django).

comment:2 Changed 5 years ago by andrew

  • Status changed from new to closed
  • Version set to subversion
  • Resolution set to wontfix

Yes, the problem here is that multilingual is one of those apps that creates models on-the-fly; I always knew these wouldn't work with South, and that's a design choice at the moment. If and when introspecting models becomes feasible, this might change, but for now, this is a WONTFIX.

comment:3 Changed 5 years ago by andrew

(from mailing list)

Simple workaround

define your Translation outside of the model:

class BlogTranslation(multilingual.Translation):
    title = models.CharField(max_length=255)

class Blog(models.Model):
    Translation = BlogTranslation
    owner = models.ForeignKey(User, related_name="blogs")

Now the Translation model will be picked up by South.

You'll still need to add definitions to two fields in the migration:

('language_id', models.PositiveIntegerField()),
('master', models.ForeignKey(orm.Blog, related_name="translations")),

and also in the models section:

'language_id': ('models.PositiveIntegerField', [], {}),
'master': ('models.ForeignKey', ["orm['blog.Blog']"], {'related_name':

Changed 5 years ago by neeleshs@… See get_model_tree(..)

comment:4 Changed 5 years ago by neeleshs@…

In our project,we ran in to the same issue. Most of our models were multilingual and we wanted to avoid manually editing the generated migration files. So we modified, get_model_tree(...) to "generate" the source for on-the-fly models. Its worked well so far.

If you find that there is any value in this approach, please let me know, I'll attach a formal patch file.(Right now, there is a bit of multilingual specific hard-coding)

comment:5 Changed 5 years ago by andrew

South now uses introspection, not parsing, to generate source, and so works better with dynamically-created code. django-multilingual can probably be supported in a similar way to django-modeltranslation, for which I have a patch at

comment:6 Changed 5 years ago by Peppe bergqvist

I have made a patch fro django-multilingual that solves this, take a look at for more info.


Add a comment

Modify Ticket

as closed

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.