Re: rollback the update query

2015-05-13 Thread Simran Singh
Hi Tom, Thanks a lot for your efforts. It worked with savepoint called before update query. Thank you Regards, Simran On Monday, May 11, 2015 at 4:27:50 PM UTC+5:30, Simran Singh wrote: > > I am really new to Django and I am using Django 1.8. Many of the > manual_transaction features have be

Re: rollback the update query

2015-05-13 Thread Simran Singh
Hi James, Yes, it workedd :) I created the object outside the method and called it at every transaction point in the loop and when there is rollback, it rollbacks all the queries. Thanks James Regards, Simran On Monday, May 11, 2015 at 4:27:50 PM UTC+5:30, Simran Singh wrote: > > I am really

Re: rollback the update query

2015-05-13 Thread James Schneider
Did you try changing the position of the save point like I mentioned? -James On May 13, 2015 9:33 PM, "Simran Singh" wrote: > Hi James, > > Thanks for your feedback. I basically want to rollback that query where I > update the db. Basically I want to rollback all the updates that were made > dur

Re: rollback the update query

2015-05-13 Thread Simran Singh
Hi James, Thanks for your feedback. I basically want to rollback that query where I update the db. Basically I want to rollback all the updates that were made during that transaction. Tried out the method of custom Exception as suggested by Tom but somehow my bad luck that it is still not worki

Re: rollback the update query

2015-05-13 Thread Simran Singh
Hi Tom, I tried the code that you posted but somehow it is giving* UnexpectedNoAssetSpecificationException at /reservation/ *error. I am not sure but when this exception is raised, then control is not going to class UnexpectedNoAssetSpecificationException(Exception): pass and when it goes

Re: rollback the update query

2015-05-13 Thread James Schneider
> asset_spec = AssetSpecification.objects.filter(asset_id_id=inventory,utilized_value=0).values_list('asset_id', flat=True) > trans = transaction.savepoint() // Here I am trying not to commit the code and store it in transaction. > > if

Re: rollback the update query

2015-05-13 Thread Simran Singh
Hi Tom, All these conditions are to be verified before data received from the form is saved in database. I tried this Exception method but when the control goes to except block, new page is rendered but *all the transactions that were completed till this point are committed after this point*.

Re: rollback the update query

2015-05-13 Thread Tom Evans
On Wed, May 13, 2015 at 9:37 AM, Simran Singh wrote: > Tom, basically I want to discard everything that is stored in > transaction.savepoint. As per my current case, it is getting committed no > matter where the flow goes. Yes, so you don't want savepoints. Savepoints are for rolling back a *subs

Re: rollback the update query

2015-05-13 Thread Simran Singh
Tom, basically I want to discard everything that is stored in transaction.savepoint. As per my current case, it is getting committed no matter where the flow goes. Regards, Simran On Monday, May 11, 2015 at 4:27:50 PM UTC+5:30, Simran Singh wrote: > > I am really new to Django and I am using Dj

Re: rollback the update query

2015-05-13 Thread Tom Evans
On Wed, May 13, 2015 at 6:36 AM, Simran Singh wrote: > Hi Tom, > > If you see then in if block, I am creating my savepoint. At any point of > time, if the condition is not met and control goes to else block then I want > to rollback all the changes that are saved in transaction and redirect it to

Re: rollback the update query

2015-05-12 Thread Simran Singh
Hi Tom, If you see then in *if *block, I am creating my savepoint. At any point of time, if the condition is not met and control goes to *else* block then I want to rollback all the changes that are saved in transaction and redirect it to some other page and not commit anything to db. I am able

Re: rollback the update query

2015-05-12 Thread Tom Evans
On Tue, May 12, 2015 at 7:47 AM, Simran Singh wrote: > Thanks Tom for your response. I am attaching piece of code of what I have > done. I hope this could help. > > @transaction.atomic(None, True) > def reservation(request): > > if request.method == 'POST': > reservation_form = Reserva

Re: rollback the update query

2015-05-11 Thread Simran Singh
Thanks Tom for your response. I am attaching piece of code of what I have done. I hope this could help. @transaction.atomic(None, True) def reservation(request): if request.method == 'POST': reservation_form = ReservationForm(request.POST) if reservation_form.is_valid():

Re: rollback the update query

2015-05-11 Thread Tom Evans
On Mon, May 11, 2015 at 11:44 AM, Simran Singh wrote: > I am really new to Django and I am using Django 1.8. Many of the > manual_transaction features have been depreciated in this. I have used > @transaction.atomic(None, True) nit; these are the defaults. You might as well just say: @transact