﻿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
8015	OneToOne Fields excluded from ModelForms	Eric Abrahamsen	nobody	"Since r8033 all !ModelForms (including those in the admin site) made from a model with a !OneToOne field exclude that field from the form. This means all models with !OneToOne fields raise !ImproperlyConfigured errors in the admin site, unless the !OneToOne field is explicitly excluded using the model's !ModelAdmin configuration.

The relevant diff from that changeset:

{{{
===================================================================
--- django/db/models/fields/related.py  (revision 8032)
+++ django/db/models/fields/related.py  (revision 8033)
@@ -706,6 +706,7 @@
     """"""
     def __init__(self, to, to_field=None, **kwargs):
         kwargs['unique'] = True
+        kwargs['editable'] = False
         if 'num_in_admin' not in kwargs:
             kwargs['num_in_admin'] = 0
         super(OneToOneField, self).__init__(to, to_field,
OneToOneRel, **kwargs)
Index: tests/regressiontests/model_inheritance_regress/models.py
===================================================================
}}}
r8033 was related to making model inheritance work in the admin site. I'm currently at r8130, and commenting out the {{{""kwargs['editable'] = False""}}} line above makes everything work as expected (!OneToOne fields appear in !ModelForms and !ModelAdmin). I'm not using model inheritance, though, so can't say if removing this line would break that – I assume it would."		closed	Forms	1.0-alpha		duplicate	OneToOne, ModelForm, ModelAdmin		Unreviewed	0	0	0	0	0	0
