#9693: Custom Model.save() don't change relational data when editing via admin
(probably any other forms too)
---------------------------+------------------------------------------------
 Reporter:  anonymous      |       Owner:  nobody    
   Status:  new            |   Milestone:            
Component:  Uncategorized  |     Version:  1.0       
 Keywords:                 |       Stage:  Unreviewed
Has_patch:  0              |  
---------------------------+------------------------------------------------
 Consider following models:
 {{{
 #!python
 class A(models.Model):
     name = models.CharField(max_length = 100)

 class B(models.Model):
     name = models.CharField(max_length = 100)
     related = models.ForeignKey(to = A, null = True, blank = True)

     def save(self):
         if not self.name.startswith('@'):
             self.name = '@' + self.name # this will work always
         if self.related and self.related.name.startswith('@'):
             self.related = None # won't work when editing via admin form
         super(B, self).save()
 }}}
 This illustrates that submitting the data via admin interface will always
 override relational changes in the custom Model.save() method. Other
 fields, however, are changed as expected.

 Calling save() under some other circumstances will always change
 relational data as expected.

 Any glue how to fix it? Thanks.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9693>
Django <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