On Thu, Nov 26, 2009 at 6:01 AM, Tom Evans wrote:
> On Thu, Nov 26, 2009 at 2:35 AM, fallhunter wrote:
>>
>> i have this code in my tests.py:
>>
>> from models import *
>>
>> and in the models.py I have a signal handler and register it with
>>
>>
Hi David,
> models.signals.post_save.connect(flaggedentry_post_save,
> sender=FlaggedEntry, dispatch_uid='mofin.store.models')
Top tip - this worked perfectly. I see this is documented only on the
wiki, I couldn't find it in the official docs.
> I've found a useful place to put signal
>> Python treats them as
>> two different files, and hence the signal is attached twice.
> -> models.signals.post_save.connect(flaggedentry_post_save,
> sender=FlaggedEntry)
> Or is there likely to be something else we've got wrong
> in our app?
>
Well, just in case - watch out for the
Hi,
>
> > can't i put "from models import *" in the test code? what should i do?
>
> This happens if you import the same file using two different names. Eg, here
> you are importing it as 'from models import *'. In some other part of your
> code, you probably have 'from foo.models import *'.
On Thu, Nov 26, 2009 at 2:35 AM, fallhunter wrote:
> i have this code in my tests.py:
>
> from models import *
>
> and in the models.py I have a signal handler and register it with
>
> post_save.connect( post_save_note, sender=Note )
>
> and when i run test with
i have this code in my tests.py:
from models import *
and in the models.py I have a signal handler and register it with
post_save.connect( post_save_note, sender=Note )
and when i run test with ./manage.py test main
I found the signal handler was registered twice and executed twice,
and I
6 matches
Mail list logo