Opened 11 years ago

Closed 11 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 Mitar, 11 years ago

Cc: mmitar@… added

comment:2 by loic84, 11 years ago

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_label could be customized in AppConfig? That way, we wouldn't impose anything on how the python code should be laid out?

comment:3 by Aymeric Augustin, 11 years ago

Triage Stage: UnreviewedAccepted

comment:4 by loic84, 11 years ago

Cc: loic@… added

It seems #21683 proposes to do exactly that which answers all my concerns.

comment:5 by Stephane "Twidi" Angel, 11 years ago

Cc: Stephane "Twidi" Angel added

comment:6 by Aymeric Augustin, 11 years ago

Yes #21683 is most likely a prerequisite to pull this off without getting stoned by our users.

comment:7 by Aymeric Augustin, 11 years ago

Summary: Forbid apps with conflicting labelsForbid 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:9 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In 553500133cc4426f20407391f3493716357db45f:

Removed an obsolete unicity check.

It doesn't account for app configs.

Refs #21679.

comment:10 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

In 5dfec4e23b4a3b81f8ec19bf0cf45147ad6b18e5:

Checked unicity of app config names when populating the app registry.

This check will miss duplicates until the check for duplicate labels is
added.

Refs #21679.

comment:11 by Aymeric Augustin <aymeric.augustin@…>, 11 years ago

Resolution: fixed
Status: newclosed

In 63137a8304d4387132e749c97aad1049526f601c:

Enforced unicity of app labels.

Fixed #21679.

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