          Tries to create an object using passed params.
          Used by get_or_create and update_or_create
          """
          try:
              obj = self.model(**params)
              sid = transaction.savepoint(using=self.db)
              obj.save(force_insert=True, using=self.db)
              transaction.savepoint_commit(sid, using=self.db)
              return obj, True
          except DatabaseError:
              transaction.savepoint_rollback(sid, using=self.db)
 
</s> remove             six.reraise(sys.exc_info())
 </s> add             six.reraise(*sys.exc_info()) </s> remove         except DatabaseError:
 </s> add         except DatabaseError as e: </s> remove             sid = transaction.savepoint(using=self.db)
 </s> add 
          Tries to create an object using passed params.
          Used by get_or_create and update_or_create
          """
          try:


              obj.save(force_insert=True, using=self.db)
              transaction.savepoint_commit(sid, using=self.db)
              return obj, True
          except DatabaseError:
              transaction.savepoint_rollback(sid, using=self.db)
keep keep keep keep replace replace keep keep keep keep keep
 Fixed #20761 -- Fixed DatabaseError handling in get_or_create and update_or_create. 
django/db/models/query.py