#7853: django admin problem used model inheritance
---------------------------------------+------------------------------------
          Reporter:  [EMAIL PROTECTED]  |         Owner:  nobody           
            Status:  reopened          |     Milestone:                   
         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 Sanha):

  * keywords:  model inheritance, django admin => model inheritance
  * resolution:  duplicate =>
  * status:  closed => reopened
  * component:  django-admin.py => Database wrapper

Comment:

 I think that second issue is valid.

 when parent model has foreign key to self, delete child (or parent) object
 was failed because finding parent's foreign key.

 see below.

 {{{
 class Parent(models.Model):
     s = models.ForeignKey('self', null=True, blank=True)
 # or same:  s = models.ForeignKey('Parent', null=True, blank=True)
     a = models.TextField()

 class Child(Parent):
     b = models.TextField()
 }}}

 python shell

 {{{
 >>> child = Child.objects.create(a='parent field', b='child field')
 >>> child.delete()
 Traceback (most recent call last):
   File "<console>", line 1, in <module>
   File "/usr/lib64/python2.5/site-packages/django/db/models/base.py", line
 423, in delete
     delete_objects(seen_objs)
   File "/usr/lib64/python2.5/site-packages/django/db/models/query.py",
 line 836, in delete_objects
     update_query.clear_related(field, pk_list)
   File "/usr/lib64/python2.5/site-
 packages/django/db/models/sql/subqueries.py", line 211, in clear_related
     self.execute_sql(None)
   File "/usr/lib64/python2.5/site-
 packages/django/db/models/sql/subqueries.py", line 112, in execute_sql
     super(UpdateQuery, self).execute_sql(result_type)
   File "/usr/lib64/python2.5/site-packages/django/db/models/sql/query.py",
 line 1608, in execute_sql
     cursor.execute(sql, params)
   File "/usr/lib64/python2.5/site-packages/django/db/backends/util.py",
 line 18, in execute
     return self.cursor.execute(sql, params)
 ProgrammingError:  "s_id" column is not exist at "forums_child" relation.
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/7853#comment:3>
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