#24981: Importing an abstract model from a bare package fails.
-------------------------------+--------------------
     Reporter:  skorokithakis  |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Uncategorized  |    Version:  1.8
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 I have an abstract model called CharIDModel in
 myproject/utils/__init__.py. If I import it as "from utils import
 CharIDModel" and inherit from it, makemigrations crashes with:

 {{{
 Traceback (most recent call last):
   File "./manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/home/user/.virtualenvs/project/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 385, in
 execute_from_command_line
     utility.execute()
   File "/home/user/.virtualenvs/project/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 354, in execute
     django.setup()
   File "/home/user/.virtualenvs/project/local/lib/python2.7/site-
 packages/django/__init__.py", line 21, in setup
     apps.populate(settings.INSTALLED_APPS)
   File "/home/user/.virtualenvs/project/local/lib/python2.7/site-
 packages/django/apps/registry.py", line 108, in populate
     app_config.import_models(all_models)
   File "/home/user/.virtualenvs/project/local/lib/python2.7/site-
 packages/django/apps/config.py", line 202, in import_models
     self.models_module = import_module(models_module_name)
   File "/usr/lib/python2.7/importlib/__init__.py", line 37, in
 import_module
     __import__(name)
   File "/home/user/Code/Django/project/main/models.py", line 11, in
 <module>
     from utils import dt_today, CharIDModel
   File "/home/user/Code/Django/project/utils/__init__.py", line 48, in
 <module>
     class CharIDModel(models.Model):
   File "/home/user/.virtualenvs/project/local/lib/python2.7/site-
 packages/django/db/models/base.py", line 115, in __new__
     kwargs = {"app_label": package_components[app_label_index]}
 IndexError: list index out of range
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24981>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/056.993582a0babb20e559115ea92e34ef47%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to