#23465: Inheritance destroying data in original model
-------------------------------------+-------------------------------------
     Reporter:  leandropls           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.6
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:                       |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by sargikk):

 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Another example with same problem when OneToOneField related to the
 inherited model.

 {{{#!python
 from django.contrib.auth.models import User
 (...)
 class PersonUser(User):
     name = models.CharField(max_length=255)
     surname = models.CharField(max_length=255)

 class OnetoOneToUser(Model):
     user = models.OneToOneField(Parent, blank=True, null=True)
     info = models.CharField(max_length=255, default='some parent info')
 }}}


 {{{#!python
 >>> person_user = PersonUser(username = 'first_user', name='1',
 surname='1')
 >>> person_user.save()
 >>> User.objects.all()
 [<User: first_user>]
 >>> one_to_one = OnetoOneToUser(user=person_user)
 >>> one_to_one.save()
 >>> person_user_2 = PersonUser(username = 'second_user', name='1',
 surname='1')
 >>> person_user.save()
 >>> User.objects.all()
 [<User: second_user>]
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23465#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.c1d2c52a7e490abd28281489a0898c8c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to