#13903: Auto app_label creation fails when model is defined at top-level python
modules
---------------------------+------------------------------------------------
 Reporter:  petraszd       |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  SVN       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 Pseudo file structure:
 {{{
 ./project
    somefile.py
    /app1
      models.py
 }}}

 somefile.py has abstract models.Model subclass
 models.py uses class from somefile.py

 It throws an Exception, because of the way ModelBase class calculates
 app_label:
 {{{
 kwargs = {"app_label": model_module.__name__.split('.')[-2]}
 }}}
 module is at top level so it has no -2 index fails.

 I understand that there so requirements where models should be defined --
 but django should not fail (with strange IndexError) too.


 I am adding fix and test case.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13903>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to