#8694: Change page for model with a OneToOne field doesn't display related field
value
-----------------------------+----------------------------------------------
 Reporter:  kmtracey         |       Owner:  nobody    
   Status:  new              |   Milestone:  1.0       
Component:  Admin interface  |     Version:  SVN       
 Keywords:                   |       Stage:  Unreviewed
Has_patch:  0                |  
-----------------------------+----------------------------------------------
 This ticket is an attempt to state one simple re-creatable problem so as
 to simplify the tangled issues raised in #8241 and #8562.

 Given these models:

 {{{
 from django.db import models

 # Create your models here.
 class Parent(models.Model):
     name = models.CharField(max_length=50)
     def __unicode__(self):
         return self.name

 class Child(models.Model):
     name = models.CharField(max_length=50)
     parent = models.OneToOneField(Parent, primary_key=True)
     def __unicode__(self):
         return '%s, child of %s' % (self.name, unicode(self.parent))

 }}}

 and this admin.py:

 {{{
 from django.contrib import admin
 from inlinet1.models import Parent, Child

 class ParentAdmin(admin.ModelAdmin):
     list_display = ('name',)

 class ChildAdmin(admin.ModelAdmin):
     list_display = ('name', 'parent',)

 admin.site.register(Parent, ParentAdmin)
 admin.site.register(Child, ChildAdmin)

 }}}

 From the admin:

 1 - Select Add on Parents, fill in name, save

 2 - Select Add on Childs, fill in name, select parent from 1, select "Save
 and continue editing"

 On re-display of the change page, the select box widget for 'Parent' will
 be set to '-----'.  This was introduced by the fix for #7888 and may be
 fixed by one of the patches on #8241, Brian understands that better than
 I.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/8694>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to