Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#16538 closed Bug (needsinfo)

Models fail to sync when using multiple app_label in same models.py

Reported by: echos Owned by: nobody
Component: Database layer (models, ORM) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

from django.db import models

class ModelOne(models.Model):
    # fields

    class Meta:
        app_label = 'app_one'

class ModelTwo(models.Model):
    # fields

    class Meta:
        app_label = 'app_two'

In the above example ModelOne will not create a table in the database but ModelTwo will.

Change History (2)

comment:1 follow-up: Changed 4 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

What's the use case of having models from one models module in more than one app? What's the name of the app containing these models?. With the data given in the report, seems to me like stretching that app_label facility too far and possibly using it for something too different from what it has been created for.

comment:2 in reply to: ↑ 1 Changed 4 years ago by echos

Replying to ramiro:

What's the use case of having models from one models module in more than one app? What's the name of the app containing these models?. With the data given in the report, seems to me like stretching that app_label facility too far and possibly using it for something too different from what it has been created for.

The use case is in a multi-db setup partitioning the models between multiple databases.

Note: See TracTickets for help on using tickets.
Back to Top