On Mon, Jun 2, 2008 at 8:19 AM, Elizabeth Kellner <[EMAIL PROTECTED]>
wrote:

> 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.
>

Have you done any experimentation to see how far off working it is in the
newforms-admin branch...and whether it's any easier to fix there?  I believe
the plan is to implement this support exclusively in newforms-admin and not
worry about getting it to work on the old admin.  (Someone changed the
ticket to specify a version of 'SVN'...which is accurate insofar as the
problem exists in SVN trunk, but inaccurate in that I don't believe a fix
will be developed for trunk, only newforms-admin which will get to trunk at
some point.)

(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
> )
>

It does seem to me that the doc should mention that Admin doesn't currently
support model inheritance (care to open a ticket/provide a patch?).  Though
I know the core devs have a policy of not documenting bugs, this I don't
think is a bug so much as not-yet-implemented support, which I think
deserves mention somewhere in the docs.  I feel like I'm seeing a lot of
people run into trouble here and reporting it on the list....

Karen

--~--~---------~--~----~------------~-------~--~----~
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