6

Using the 'app_label' in the 'Class Meta' will solve this problem. But it won't create tables while issuing 'syncdb' command. Because the app name won't match with INSTALLED_APPS entry. Is there any way to achieve both (custom app name and creating tables with syncdb)

Siva Arunachalam
  • 7,582
  • 15
  • 79
  • 132

1 Answers1

0

I haven't tried this, but here there is a solution that should allow changing the app label while working with syncdb.

class model_module1(models.model):
    [...]

    class Meta:
        app_label = "Cool module name"
        db_table = "module1_model"

class model_module2(models.model):
    [...]

    class Meta:
        app_label = "Cool module name"
        db_table = "module2_model"

This makes sense, since the name of the table is made explicit, so there is no guessing when running syncdb. The downside is that this two Meta options must be specified in every model of the app.

Community
  • 1
  • 1
Armando Pérez Marqués
  • 5,661
  • 4
  • 28
  • 45