Re: CSV updater, 2 saves in one function. Problem?

2008-07-11 Thread Frantisek Malina
Thank you for your input all. Now it works perfect: http://dpaste.com/hold/62755/ I've inserted print statements by every line just to find out I forgot to call products = Product.objects.order_by('sku') after the second save() to get the updated stock. That said it always worked, I just

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Eric Abrahamsen
>> print p.sku, p.items_in_stock >> #Returned only the last line >> BWC300SS 22 >> >> I don't get it why it didn't return the full excel feed again. When in doubt, throw more print statement in! Try putting one after this line: p = Product.objects.get(sku=update_sku) To make sure you're

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Steve Potter
> > print update_sku, update_stock > #Returned the whole feed > 2817312 130 > 2842300 22 > 2846762 50 > 2859391 22 > BPC60SS 22 > BPC70SS 2 > BPC90SS 2 > BPS60SS 22 > BPS70SS 22 > BPS90SS 22 > BTD600 22 > BWC150SS 80 > BWC300SS 22 > > print p.sku, p.items_in_stock > #Returned only the last line

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Frantisek Malina
Can I make this work somehow with signals? --~--~-~--~~~---~--~~ 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

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Frantisek Malina
Hooray, I've got the exception to work. Although the stock is still all zeros. If I remove lines... for product in products: product.items_in_stock = 0 product.save() ...updating works. However I need to zero all the stock before I update, because my feed does not contain

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Frantisek Malina
I am sorry for being a bad guy, it's 1AM in my timezone and I've just went through a couple of python beginner headaches. So I took the-baby- crying-most-will-get-served-first approach. Never again, I promise. I updated the code to use Excel instead of CSV to save some heavy lifting.

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Daniel Roseman
On Jul 10, 7:47 pm, Frantisek Malina <[EMAIL PROTECTED]> wrote: > Hi all? > I am trying to update stock in my django shopping cart from the CSV > feed. > I am doing this regularly so I need to zero the stock first and loop > trough the CSV to update. > The problem is that the following code will

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Frantisek Malina
Please help. Dpaste here: http://dpaste.com/hold/62198/ --~--~-~--~~~---~--~~ 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

Re: CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Frantisek Malina
Hey gang, Please help. What's wrong with the above code? --~--~-~--~~~---~--~~ 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

CSV updater, 2 saves in one function. Problem?

2008-07-10 Thread Frantisek Malina
Hi all? I am trying to update stock in my django shopping cart from the CSV feed. I am doing this regularly so I need to zero the stock first and loop trough the CSV to update. The problem is that the following code will only zero the stock and will not update. How to get around it? Is there a