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
-~----------~----~----~----~------~----~------~--~---

Reply via email to