Monday 15 August 2011

python - Cant get post_save to work in Django -


I read django docs about signals and paste this piece Written code for my model code car :

  @receiver (request_finished) def signal_callback (Sender, ** kwargs): Print 'Save Signal Received' @receiver ( Post_save, sender = car) DEF signal_handler (sender, ** quargs): The pass was requested (to request), (when I set a fire) Open your server, and just open the admin, I have lots of code  'Sign Get 'receive  in my terminal. What I'm thinking about, I've restricted the  signal_handler  to  post_save . But still, without saving anything, the message often shows I'm not Understand  

Note: I will be honest. I understand some parts of it, not everything from the documentation.

There is a simple way to bind

  to django.db Import .models.signals import post_save from my_podels car def some (sender, ** kwargs): print 'object is now saved.' Car = kwargs ['example'] # now I have access to the object post_save.connect (do_something, sender = car)   

the signal is called every time An HTTP request is made, which is a hog

No comments:

Post a Comment