﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1686	Relative model import should work within app directory	James Bennett	Adrian Holovaty	"Assume a project with an application called 'weblog', whose models live in the directory weblog/models.py, and with a model class called 'Entry'.

From within the top-level directory for the project, doing 'from weblog.models import Entry' works as expected.

From within the 'weblog' directory, doing 'from models import Entry' '''should''' work, but instead produces this traceback:

{{{
Traceback (most recent call last):
  File ""<stdin>"", line 1, in ?
  File ""models.py"", line 17, in ?
    class Category(models.Model):
  File ""/Users/jbennett/dev/092/magic-removal/django/db/models/base.py"", line 45, in __new__
    new_class._meta.app_label = model_module.__name__.split('.')[-2]
IndexError: list index out of range
}}}

It'd be nice if Django could handle this situation, as it makes app-specific URL configuration ever so much nicer (e.g., model imports to get QuerySets for generic views won't need the full path to the model, and hence won't be coupled to the project)."	defect	closed	Core (Other)	magic-removal	normal	duplicate			Unreviewed	0	0	0	0	0	0
