Opened 14 years ago

Closed 14 years ago

#14542 closed (invalid)

Short model names break

Reported by: Personman Owned by: nobody
Component: Uncategorized Version: 1.2
Severity: 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

One-character model names appear to break Django:

>>> class A(models.Model):
...    pass
... 
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 48, in __new__
    kwargs = {"app_label": model_module.__name__.split('.')[-2]}
IndexError: list index out of range

Change History (1)

comment:1 by Personman, 14 years ago

Resolution: invalid
Status: newclosed

Oopsies. Apparently something else is wrong, because this happens with names of any other length, too:

class Parent(models.Model):

... bar = models.ForeignKey('Foo')
...
Traceback (most recent call last):

File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/base.py", line 48, in new

kwargs = {"app_label": model_module.name.split('.')[-2]}

IndexError: list index out of range

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