That seems to have done it, thanks for the heads up on moving it to the models....
- JM On Dec 14, 10:22 am, "Bruce Kroeze" <[email protected]> wrote: > On Sun, Dec 14, 2008 at 10:15 AM, joshm <[email protected]> wrote: > > > That didn't quite do it, but I see where your going here, perhaps I'm > > supposed to import SImplePayShipForm or something like that and then > > use sender=SimplePayShipForm ? I tried that but got a different > > error. > > > Anyways, I will keep digging...thanks for your prompt responses. > > > - JM > > I checked the project for which I wrote that listener. Yes, I import > SimplePayShipForm. > > Here's the setup: > > In the project app, whatever you call it, you should have a "models" file, > even if you don't have models., because that will always get loaded and has > some protection against circular imports. At the end of that, I do: > > import listeners > listeners.start_listening() > > And then in listeners, I do: > > from satchmo.payment.listeners import shipping_hide_if_one, > form_terms_listener > from satchmo.payment.forms import SimplePayShipForm > from satchmo.payment.signals import payment_form_init > > def start_listening(): > payment_form_init.connect(form_terms_listener, sender=SimplePayShipForm) > payment_form_init.connect(shipping_hide_if_one, > sender=SimplePayShipForm) > > In testing, I find this the best path, much better than using __init__, due > to Django model instantiation. In other words, it seems like it works > reliably and doesn't blow up during app bootstrapping. > > Good luck, > Bruce --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
