Dmitriy Berkutov
Dmitriy Berkutov

Reputation: 103

South custom models location

I have quite a big django project which has a lot of applications and a lot of models. In order to avoid circular imports several models modules must be used:

app/models.py
app/models_add.py
app/models_aux.py

and so on. Each time I have to make a migration I have to write

from app.models_add import Model

in the app/models.py in order for South to track the model's changes. This seems to be quite annoying because there are a lot of changes in models.

The question is: is there a way to point South which modules/files to track?

Upvotes: 0

Views: 76

Answers (1)

Buddy Lindsey
Buddy Lindsey

Reputation: 3630

You could try setting the app_label on the Meta class of your model.

class Meta:
    app_label = "app"

Also try setting your directory structure to:

app/models/__init__.py
app/models/add.py

That should tell everything to initialize properly. This is what I recently did, but for backwards compatibility in other areas of my project I import everything in models/__init__.py

Upvotes: 1

Related Questions