Hello,

what is the right way to handle events from livesetting ie. from an admin 
interface ?

For example when as an admin I did removed order item from an order.
I did attached listener to general signal of Django model:

from django.db.models import signals as signals_models
>
> signals_models.pre_delete.connect(increase_inventory_on_orderitem_removal)
>

Because it's a very general signal I need to distinguish between 
`pre_delete' sent from admin removal and from a checkout process.
Now I check this by status of an order:

def increase_inventory_on_orderitem_removal(sender, instance, *args, 
> **kwargs):
>     # check if object is a really an order item
>     if isinstance(instance, OrderItem):
>         # check if order was confirmed and can be cancelled
>         if instance.order.status and \
>             instance.order.status not in ('Shipped', 'Completed', 
> 'Cancelled'):
>

I find it a bit hackish and doubt if it's really reliable way.

Is there some better way ?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/satchmo-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to