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 feat
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
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
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
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
> 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
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*.
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
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
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
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
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
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():
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
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)* to pack the transaction and rollback the updates if at any point the
condition is not met.
I tried to store the transaction
Cool.
So I guess we have a doc bug against the queryset API reference.
Sim, if you're still reading this, and updating stuff in the database is
what you were trying to do, then turn you computes collection of
changes into a dictionary (if it isn't one already), "d" below, and do:
User.objects
On Fri, May 14, 2010 at 3:26 PM, Bill Freeman wrote:
> Actually, there would be a real advantage to doing update in the
> DB rather than instantiating the model, changing it, and saving it,
> since sql update is a single transaction. If that's what queryset
> update does, then the only issue with
Actually, there would be a real advantage to doing update in the
DB rather than instantiating the model, changing it, and saving it,
since sql update is a single transaction. If that's what queryset
update does, then the only issue with your version is that you
needed two asterisks, passing "some_
On May 13, 6:48 pm, Bill Freeman wrote:
> Or you could be right. I'm still not clear on the OP's intent.
I suspect both would work, with my solution relying on a queryset
containing a single object. Yours is cleaner!
Regards
Scott
--
You received this message because you are subscribed to the
Or you could be right. I'm still not clear on the OP's intent.
On Thu, May 13, 2010 at 4:21 PM, zinckiwi wrote:
> Quite right, I was confusing it with QuerySet's update(), as
> demonstrated in the docs:
>
> # Update all the headlines with pub_date in 2007.
> Entry.objects.filter(pub_date__year=2
Quite right, I was confusing it with QuerySet's update(), as
demonstrated in the docs:
# Update all the headlines with pub_date in 2007.
Entry.objects.filter(pub_date__year=2007).update(headline='Everything
is the same')
Regards
Scott
On May 13, 3:14 pm, Bill Freeman wrote:
> Update still take
Update still takes exactly one argument: self.
I'm still not completely clear on what the OP is trying to do so I'll
guess that for a given User object (id == 11) you want to adjust
a set of attributes not known apriori, but available as key - value
pairs from an itterator I'll call 'd.items()':
> What if field_name and value coming from loop?
> I have around 50 field and values in loop.
> Can I do this? I know this is silly way to do but please guide how can
> I do this?
>
> for key, value in users:
> user."%s" = "%s" % (key, value)
>
> user.save()
Ah, I see. In that case you will wan
Scott,
Thank you very much for your reply and giving me very nice and simpler
idea but I have one question:
What if field_name and value coming from loop?
I have around 50 field and values in loop.
Can I do this? I know this is silly way to do but please guide how can
I do this?
for key, value in
> I am little confused about it. I am not sure django allow this or not.
> Please correct me.
>
> string = last_name = 'Riaz edit', first_name = 'Asim edit',
> nationality = 'se'
> User.objects.filter(id=11).update(string)
>
> I am using this and its giving me this error:
>
> update() takes exact
Hello All,
I am little confused about it. I am not sure django allow this or not.
Please correct me.
string = last_name = 'Riaz edit', first_name = 'Asim edit',
nationality = 'se'
User.objects.filter(id=11).update(string)
I am using this and its giving me this error:
update() takes exactly 1
On Sat, Feb 27, 2010 at 10:07 PM, Harley Bussell wrote:
> Hi, id like to know if any one has found a work around to use limits
> when updating a query set.
This is unlikely to be supported by Django; "UPDATE ... LIMIT" is
non-standard, non-portable and MySQL is the only DB supporting it out
of th
Hi, id like to know if any one has found a work around to use limits
when updating a query set.
I'm trying to lock a number of the oldest rows in a table.
update job set lock='lockid' where lock ='' order by created limit 10;
Ideally id like to do something like this:
Job.objects.filter(lock='').
28 matches
Mail list logo