Opened 15 years ago
Closed 15 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
      
  Note:
 See   TracTickets
 for help on using tickets.
    
Oopsies. Apparently something else is wrong, because this happens with names of any other length, too:
... bar = models.ForeignKey('Foo')
...
Traceback (most recent call last):
IndexError: list index out of range