hi,

obj.id ?

BILLION Sébastien

the Answer to the ultimate question of life, the universe and everything is 42

http://www.sebastienbillion.com/ <http://www.sebastienbillion.com/>

Le 06/10/2011 11:10, bino oetomo a écrit :
Dear All ..

From the basic tutorial of "Polls",
I add this lines to model.py
----START--------
from django.db.models.signals import post_save

def do_something(sender, **kwargs):
    print "==========START==========="
    print "Called by : " , sender
    print "This is KWARGS :"
    print kwargs
    obj = kwargs['instance']
    print "This is instances :"
    print obj
    print "=========DONE============"

post_save.connect(do_something, sender=Poll)
---Stop--

And from the debug console while I add a new record, here is what I got :

==========START===========
Called by : <class 'poll.models.Poll'>
This is KWARGS :
{'raw': False, 'signal': <django.dispatch.dispatcher.Signal object at 0x8ddab6c>, 'instance': <Poll: WhatsUp ?>, 'created': True}
This is instances :
WhatsUp ?
=========DONE============

My question : How to het the primary key of involved object/instance (the "id" Column in table) ?
When I try to use --> print Poll.id
It raise traceback that state (more/less) : Model 'Poll' have no object named 'id'

Kindly please give me your enlightment

Sincerely
-bino-


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to