M
M
m0ody2014-12-21 15:07:28
Django
m0ody, 2014-12-21 15:07:28

Django: how to change app_label on models?

The application has the following structure:
django_project
-- twitter
---- sub_app1
------ models.py
------ ...
---- sub_app2
------ models.py
---- -- ...
INSALLED_APPS is the following:

INSTALLED_APPS = (
     'twitter.sub_app1',
     'twitter.sub_app2'
)

The problem is that *._meta.app_label for models looks like: sub_app1, sub_app2 (that is, without the twitter prefix).
I tried to explicitly specify app_label for models:
class Model(models.Model):
     ....
     class Meta:
            app_label = 'twitter.sub_app1'

But after that an empty migration is created:
./manage.py schemamigration twitter.sub_app1 --initial
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        pass

    def backwards(self, orm):
        pass

    models = {
        
    }

    complete_apps = ['sub_app1']

How to convert app_label to twitter.sub_app1, twitter.sub_app2 format?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question