Thanks, here's what I did to set everything to taxable with the correct taxClass using ipython:
ch...@clairdelune:~/sites/clairdelune_live/clairdelune$ ./manage.py shell Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22) Type "copyright", "credits" or "license" for more information. IPython 0.9.1 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more. In [1]: import django In [2]: from satchmo.product.models import * In [3]: for product in Product.objects.all(): ...: product.taxable = True ...: product.taxClass = TaxClass.objects.get(id=6) ...: product.save() ...: ...: Yay! django_extensions seem awesome too. Will have to play with that. Chris On Tue, Jul 28, 2009 at 7:53 PM, Günter Walser <[email protected]>wrote: > > Even less work you have with additionally (to ipython) installing > django-command-extensions and then running > > Linux : $ ./manage.py shell_plus > Win: python manage.py shell_plus > > It will autoload all models it can find via installed apps. > > Günter > www.pal-pad.com > > > -----Ursprüngliche Nachricht----- > Von: [email protected] [mailto:[email protected] > ] > Im Auftrag von Bruce Kroeze > Gesendet: Dienstag, 28. Juli 2009 18:22 > An: [email protected] > Betreff: Re: Batch product operations via shell? > > On Tue, Jul 28, 2009 at 8:32 AM, Christopher Hart <[email protected]> > wrote: > > > Hi.. We're running Satchmmo 0.8.1 and Django 1.0.2. > > We had some product data-entry mistakes in what has become the live > site's database and although the mis-entered products are not active, we'd > like to delete them to tidy up the product listings in the admin interface. > > So, being vaguely familiar with save() and delete() from the Django > tutorials a while back, I'd like to just go into the shell and do something > like this (pseudocode.. will figure out syntax later): > > for product in all_products: > if not product.is_active > product.delete() > > Also, many products (there are hundreds in the store) were > accidentally not set as taxable, and they all need to be taxable. For this > I > was thinking of a similar approach: > > for product in all_products: > taxable = True > taxClass = Sales > product.save() > > The main questions I have are: what needs to be imported to do all > this? Is this even a sane approach? Thanks, > > > I do this kind of thing all the time. Do the following: > > Install ipython > $: ez_install ipython) > > start the shell > $ ./manage.py shell > > In [1]: from product.models import * > In [2]: # run your code here > > --- > Bruce Kroeze > http://solidsitesolutions.com > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
