Opened 12 years ago
Closed 12 years ago
#21679 closed Bug (fixed)
Forbid apps with conflicting labels or names
| Reported by: | Aymeric Augustin | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Other) | Version: | dev |
| Severity: | Normal | Keywords: | app-loading |
| Cc: | mmitar@…, loic@…, Stephane "Twidi" Angel | Triage Stage: | Accepted |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I'm almost sure Django misbehaves in a variety of ways when two apps have the same label. For starters, manage.py migrate will not pick models from one app.
Django should raise an exception if two apps have the same label. This must be implemented in Apps.populate_apps. It will make the current unicity check in django.conf redundant.
Change History (11)
comment:1 by , 12 years ago
| Cc: | added |
|---|
comment:2 by , 12 years ago
comment:3 by , 12 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:4 by , 12 years ago
| Cc: | added |
|---|
It seems #21683 proposes to do exactly that which answers all my concerns.
comment:5 by , 12 years ago
| Cc: | added |
|---|
comment:6 by , 12 years ago
Yes #21683 is most likely a prerequisite to pull this off without getting stoned by our users.
comment:7 by , 12 years ago
| Summary: | Forbid apps with conflicting labels → Forbid apps with conflicting labels or names |
|---|
AppConfig.name should also be unique across a project.
Currently there's a unicity check in django.conf but it's useless as it won't catch such duplicates.
comment:11 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
FWIW #12288 (from comment 32 onwards) has discussions regarding the backward compatibility implications of this change.
When I augment an external app
{{ app_name }}with extra templates, templatetags or basically anything other than models, I have the convention of creating an app"{{ project_name }}.{{ app_name }}".I'm not saying this change shouldn't happen, but that would be, by far, the biggest refactor required in my projects caused by a single change in Django core.
Maybe the actual
app_labelcould be customized inAppConfig? That way, we wouldn't impose anything on how the python code should be laid out?