#24287 closed Cleanup/optimization (fixed)
A model outside an app causes inane error
Reported by: | jMyles | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
To reproduce:
Create a models.py in the root of a project (ie, next to manage.py). Create a class in it that inherits from django.db.models.Model.
This causes IndexError to be raised in the new because package_components will be only models, without the app name, ie, this line:
kwargs = {"app_label": package_components[app_label_index]}
Of course, the proper thing to do is to create an app, but new users may not realize this and, given this error, may not know on what topic to seek assistance.
Change History (4)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Bug → Cleanup/optimization |
I believe #21680 is related.
comment:3 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
https://github.com/django/django/pull/4066