﻿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
13241	order_with_respect_to fails on a relationship on a model that has not yet been defined	Goldan	Gabriel Grant	"If I specify 'order_with_respect_to' on a field linked to a model that hasn't been defined yet, I get the following error:
{{{
<...>File ""/usr/lib/python2.6/dist-packages/django/db/models/base.py"", line 223, in _prepare
    setattr(opts.order_with_respect_to.rel.to, 'get_%s_order' % cls.__name__.lower(), curry(method_get_order, cls))
AttributeError: 'str' object has no attribute 'get_location_order'
}}}
When I swap declarations of Location and City models, the error disappears. 

Here is the code:
{{{
class Location(TimeStampedModel):
    '''Single location on a map, e.g. building.'''
    address = models.CharField(u""адрес"", max_length=75, help_text=u""Улица, корпус, дом"")
    city = models.ForeignKey('City', related_name=""locations"", verbose_name=u""город"")
    metro_stations = models.ManyToManyField('MetroStation', related_name=""locations"", verbose_name=u""ближайшие станции метро"", blank=True, null=True)

    class Meta:
        verbose_name = u""адрес""
        verbose_name_plural = u""адреса""
        order_with_respect_to = 'city'

class City(TimeStampedModel):
    '''A city.'''
    name = models.CharField(u""название"", max_length=30)

    class Meta:
        verbose_name = u""город""
        verbose_name_plural = u""города""
}}}"		closed	Database layer (models, ORM)	dev		fixed	order_with_respect_to	Goldan	Ready for checkin	1	0	0	0	0	0
