Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 18, 2011 09:08:22

Mo M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django custom signals


Hi,

am having problem with django custom signals not being able to see signals
across application. I made a simple call in my

*core/signals.py*

* from django.dispatch.dispatcher import Signal*
* # Signal-emitting code... emits whenever a file upload is received*
* # ----------------------------------------------------------------*
* *
* upload_recieved = Signal(providing_args=)*
* *
* *
* def upload_received_handler(sender, data, **kwargs):*
* print 'upload received handler'*
* *
* print 'connecting signal'*
* upload_recieved.connect(upload_received_handler)*

*in core/models.py*

* import signals*
* *
* *

*in blog/admin.py*

* from models import article, category, media *
* from django.contrib import admin*
* from libs.shared.core.tasks import Create_Audit_Record*
* from libs.shared.core import signals*
* *
* *
* *
* class ArticleModelAdmin(admin.ModelAdmin):*
* def save_model(self, request, obj, form, change):*
* upload_recieved.send(sender=self, data='ddd')*
* instance = form.save()*
* return instance*
* *
* *
* *
* admin.site.register(article, ArticleModelAdmin)*
* admin.site.register(category)*
* admin.site.register(media)*


this is what I did, but am getting an error in the runtime unable to see
upload_received function. any ideas?

Regards,

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 18, 2011 09:37:34

bruno d.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

django custom signals


On 18 jan, 10:08, Mo Mughrabi <mo.mughr...@gmail.com> wrote:
> Hi,
>
> am having problem with django custom signals not being able to see signals
> across application. I made a simple call in my
>
> *core/signals.py*
>
>   *  from django.dispatch.dispatcher import Signal*
> *    # Signal-emitting code... emits whenever a file upload is received*
> *    # ----------------------------------------------------------------*
> *    *
> *    upload_recieved = Signal(providing_args=)*

(snip)

> *in blog/admin.py*
>
> *    from libs.shared.core import signals*
(snip)
> *    *
> *    *
> *    class ArticleModelAdmin(admin.ModelAdmin):*
> *        def save_model(self, request, obj, form, change):*
> *            upload_recieved.send(sender=self, data='ddd')*

You want:
signals.upload_recieved.send(sender=self, data='ddd')

(snip)
> *    *
>
> this is what I did, but am getting an error in the runtime unable to see
> upload_received function. any ideas?http://docs.python.org/tutorial/modules.htmlAlso and while we're at it : avoid adding '*' around your code
snippets, it really doesn't help.
;)

--
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 athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 17th of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support