regarding Model Inheritance and the admin

I've checked out the newforms-admin branch now.  Its wonderful!  Lots
of great solutions.
As of the other day its only a few revisions away from the trunk. (the
trunk is being merged into newforms-admin)

with Model inheritance the pointer field (to the parent class' table)
is visible in the admin, and that's the field that is causing
validation errors and problems when creating and re-editing the model
(which uses two tables).


I made only one minor change to hide the pointer field:

Index: django/db/models/base.py
===================================================================
--- django/db/models/base.py    (revision 7709)
+++ django/db/models/base.py    (working copy)
@@ -102,7 +102,7 @@
                 else:
                     attr_name = '%s_ptr' % base._meta.module_name
                     field = OneToOneField(base, name=attr_name,
-                            auto_created=True, parent_link=True)
+                            auto_created=True, parent_link=True,
editable=False)
                     new_class.add_to_class(attr_name, field)
                 new_class._meta.parents[base] = field
             else:

and so far I have had no problems creating parent models, various
child models, again more parent models, again more child models.
editing has worked.

I'm new around here and don't have any tests and I'm trying to get up
to speed on too many things right now, but this is very good news to
me.

If I don't find any other errors or issues then I'll post this patch
to the original ticket.

newforms-admin looks very close to trunk mergeable.  the main issues I
would guess have more to do with disrupting everybody else because it
involves some code rewriting.  but its well worth it.

nice job guys !



On 19 Jun., 22:01, felix <[EMAIL PROTECTED]> wrote:
> I second that.  I've just spent the day quite happily refactoring my
> app to use niftymodelinheritance... and the admin doesn't work.
> whoops.
>
> I think this should be stated in the docs for sure.
>
> On Jun 2, 4:44 pm, ekellner <[EMAIL PROTECTED]> wrote:
>
> > Isnewforms-adminany closer to being merged?  This group's archives
> > says that it's quite stable and has been for some time, but I don't
> > have the impression that the merge is going to be easy or soon.
>
> > > It does seem to me that the doc should mention that Admin doesn't 
> > > currently
> > > supportmodelinheritance(care to open a ticket/provide a patch?).
>
> > (Done, #7349.  I didn't realize that the web docs were synthesized
> > from .txt in source)
>
> > 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