I'm trying to get some custom update sql to work. It seems to, but it never actually commits.
Based on this thread: http://groups.google.com/group/django-users/browse_thread/thread/318008212a9e79f9/592236423cb67439 And this doc: http://www.djangoproject.com/documentation/transactions/#django-db-transaction-commit-manually This is the current method in its entirety... @classmethod @transaction.commit_manually def force_outside(cls, location_id): sql = """update colony_agent set is_in_forcefield = 0 where location_id = %d and is_in_forcefield = 1""" % location_id #print sql rc = 0 cursor = connection.cursor() try : rc = cursor.execute(sql) except Exception, exp: print "SQL ERROR: %s" % str(exp) transaction.rollback() else: transaction.commit() return rc The row count returned is correct. There are no errors reported, but the database is not changed. Running the generated sql manually is fine. Can anyone tell me what I'm doing wrong? The documentation on the main django site doesn't seem to cover doing adds, updates, or deletes with custom sql. Only custom sql for selects is covered at: http://www.djangoproject.com/documentation/model-api/#executing-custom-sql Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---