I've had good success with placing the import at the end of the models file.

On Tuesday, 12 August 2014 20:06:41 UTC-4, chedi toueiti wrote:
>
> Hi Neto,
>
> Just make sure that your callback is loaded, the most easy way to do it is 
> to import the function in models.py if you have a single models file or in 
> the __init__.py of the models if you have it as a module.
>
> in https://docs.djangoproject.com/en/1.6/topics/signals/:
>
>
> Where should this code live?
>>
>> You can put signal handling and registration code anywhere you like. 
>> However, you’ll need to make sure that the module it’s in gets imported 
>> early on so that the signal handling gets registered before any signals 
>> need to be sent. This makes your app’s models.py a good place to put 
>> registration of signal handlers.
>>
>
> On Monday, August 11, 2014 10:02:18 PM UTC+1, Neto wrote:
>>
>> I'm trying to do a post_save but he doesn't work, I am using* 
>> objects.create()*:
>>
>> *views:*
>>
>> Usuario.objects.create(name='aaaa')
>>
>> *models:*
>>
>> @receiver(models.signals.post_save, sender=Usuario)
>> def auto_abc(sender, instance, **kwargs):
>>     ...
>>
>>
>>
>> Why my post_save doesn't work with objects.create()? How I do?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bd5f2fd0-3a0b-4017-8bd4-ab28ba6b824b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to