#13864: DatabaseError while saving with force_update set
------------------------------------------+---------------------------------
 Reporter:  fva                           |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.2       
 Keywords:  force_update DatabaseError    |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 Models:

 {{{
 class A ( models.Model ) :
     a = models.IntegerField ( null=True )

 class B ( A ) : pass
 }}}

 session:

 {{{
 In [3]: b = B()

 In [4]: b.save()

 In [5]: b.save ( force_update = True )
 ---------------------------------------------------------------------------
 DatabaseError                             Traceback (most recent call
 last)

 <ipython console> in <module>()

 django/db/models/base.pyc in save(self, force_insert, force_update, using)
     428         if force_insert and force_update:
     429             raise ValueError("Cannot force both insert and
 updating in model saving.")
 --> 430         self.save_base(using=using, force_insert=force_insert,
 force_update=force_update)
     431
     432     save.alters_data = True

 django/db/models/base.pyc in save_base(self, raw, cls, origin,
 force_insert, force_update, using)
     496                         rows =
 manager.using(using).filter(pk=pk_val)._update(values)
     497                         if force_update and not rows:
 --> 498                             raise DatabaseError("Forced update did
 not affect any rows.")
     499                 else:
     500                     record_exists = False

 DatabaseError: Forced update did not affect any rows.
 }}}

 but simple b.save() updates fine.

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