Re: Signals not working correctly

2007-09-13 Thread RajeshD



On Sep 13, 11:13 am, Greg <[EMAIL PROTECTED]> wrote:
> Hello,
> I'm trying to use signals so that when a Publication gets deleted from
> within the Admin it will 'assert False, "Here"'  (This will obviously
> change at a later date).  Currently, when I delete a Publication (in
> the django admin) no assert statement is raised.  So I guess that
> means that my dispatcher.connect is not getting called.  Anybody know
> what I'm doing wrong?

Try moving the dispatcher.connect statement to your models.py.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Signals not working correctly

2007-09-13 Thread Greg

Hello,
I'm trying to use signals so that when a Publication gets deleted from
within the Admin it will 'assert False, "Here"'  (This will obviously
change at a later date).  Currently, when I delete a Publication (in
the django admin) no assert statement is raised.  So I guess that
means that my dispatcher.connect is not getting called.  Anybody know
what I'm doing wrong?

 views.py

from mysite.test.models import Publication
from django.db.models import signals
from django.dispatch import dispatcher
from mysite.rugs.sig import thesignal

dispatcher.connect(thesignal, signal=signals.post_delete,
sender=Publication)

 sig.py

def thesignal(sender, instance, signal, *args, **kwargs):
assert False, "Here"

 models.py

class Publication(models.Model):
title = models.CharField(maxlength=30)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Signals not working correctly

2007-09-13 Thread Greg

Hello,
I'm trying to use signals so that when a Publication gets deleted from
within the Admin it will 'assert False, "Here"'  (This will obviously
change at a later date).  Currently, when I delete a Publication (in
the django admin) no assert statement is raised.  So I guess that
means that my dispatcher.connect is not getting called.  Anybody know
what I'm doing wrong?

 views.py

from mysite.test.models import Publication
from django.db.models import signals
from django.dispatch import dispatcher
from mysite.rugs.sig import thesignal

dispatcher.connect(thesignal, signal=signals.post_delete,
sender=Publication)

 sig.py

def thesignal(sender, instance, signal, *args, **kwargs):
assert False, "Here"

 models.py

class Publication(models.Model):
title = models.CharField(maxlength=30)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---