#7853: Problem with model inheritance when parent has relation to self
---------------------------------------+------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: nobody
Status: reopened | Milestone: 1.0 beta
Component: Database wrapper | Version: SVN
Resolution: | Keywords: model inheritance
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------+------------------------------------
Changes (by russellm):
* status: closed => reopened
* summary: django admin problem used model inheritance => Problem with
model inheritance when parent has relation to
self
* resolution: duplicate =>
* milestone: => 1.0 beta
Old description:
> for example,
>
> {{{
> class Parent(models.Model):
> s = models.ForeignKey('self', null=True, blank=True)
> a = models.TextField()
>
> class Child(Parent):
> b = models.TextField()
> }}}
>
> 1.
>
> When Child create in django admin, Parent reference id is not need. It
> should be inserted automatically.
> But, admin complain it is necessary.
>
> So, after I add one '''dummy Parent''', Child was created successfully
> with it's own automatically created parent's ID.
> So, number of Parent was two.
> Every create Child, choice dummy Parent is needed.
>
> 2.
>
> like above code.
> when delete Child or Parent, error occured about Child's s_id.
>
> ----
>
> these error was begined at 0.97-pre-SVN-8007
> as I know, previous version is not shown these errors.
New description:
Test models:
{{{
class Parent(models.Model):
s = models.ForeignKey('self', null=True, blank=True)
a = models.TextField()
class Child(Parent):
b = models.TextField()
}}}
Test session:
{{{
>>> child = Child.objects.create(a='parent field', b='child field')
>>> child.delete()
Traceback (most recent call last):
...
ProgrammingError: "s_id" column is not exist at "forums_child" relation.
}}}
These error was begined at 0.97-pre-SVN-8007
as I know, previous version is not shown these errors.
Comment:
Replying to [comment:4 charmless]:
> Marking a ticket as a Duplicate means the problem is known and being
worked on at another ticket. It is not meant to imply that a problem isn't
valid (if it were, the duplicate would be closed too :) )
In this case, it looks like the reporter has put two issues in a single
ticket (which, by the way, is very bad form). The first issue (inheritance
doesn't work in admin) is clearly a duplicate of #6755. The second part of
the report isn't obviously a duplicate, so it requires independent
verification.
I've updated the ticket title and description to describe the problem
better.
--
Ticket URL: <http://code.djangoproject.com/ticket/7853#comment:5>
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
-~----------~----~----~----~------~----~------~--~---