On 28 Mai, 14:15, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> Model inheritance is not supported by the admin:
>
> http://code.djangoproject.com/ticket/6755
>
> There's a patch on that ticket, but I have no idea if it works, solves the
> complete problem, etc.  (If it were as easy as that patch, I'm surprised it
> wouldn't have been done as part of qs-rf.)

It's not enough, the problem is more complex than that.  I've been
taking a look at it and I think I see the problem here (one of many
probably).

During an update of a child object, if a field isn't in the post data,
then oldforms fills in the values with blanks (specifically
do_html2python, called from change_stage about line 334).  In the
basic form of the bug, I bet that it's the primary key value in the
base class that's missing.  This is never posted -- it's part of the
path_info.  And so, oldforms will set it to None, thereby causing an
insert instead of an update.

For me, it's failing because I have a field in the base class with a
default value, which I am not displaying in admin, and so which is not
included in the form data.  Again, oldforms fills in a None value
explicitly.  The ChangeManipulator is then tricked, and will not take
the value from the existing base class object.

I wonder if there isn't a fix, aside from "change the form validation
code", which would mean "don't use oldforms".  I am leaning towards
using my own view method for this particular class in the admin tool,
or not using Django's inheritance, rather than try to get the admin
code working here.

(It would be nice to have a mention of this problem in the Multi-table
inheritance documentation!  
http://www.djangoproject.com/documentation/model-api/#multi-table-inheritance)

Elizabeth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to