﻿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
1661	Forward declaration of OneToOneField requires 'to_field' to avoid import failure	Russell Keith-Magee	Russell Keith-Magee	"njharman (lists@knoggin.com) reports:

{{{
class Foo(models.Model):
   myfield = models.OneToOneField('SomeModel', to_field='id')
}}}
Works.

{{{
class Foo(models.Model):
   myfield = models.OneToOneField('SomeModel')
}}}

Fails because whatever ""turns"" 'SomeModel' from string into class object
hasn't happened when code in
""/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django/db/models/fields/related.py
on line 510 tries to determine default to_field.

----

Model is ok during syncdb; failure occurs during import."	defect	closed	Database layer (models, ORM)	magic-removal	normal	fixed		lists@…	Unreviewed	0	0	0	0	0	0
