__init__.py
here is my structure
website_project
- > signals
- - > signals.py (and an __init__.py)
- > shared_apps (link to numerous apps shared amongst other projects)
- - > gallery application
my signals.py looks like this
from django.db.models.signals import post_save
from django.core.mail import send_mail
from gallery.models import Gallery
def send_creation(sender, instance, *args, **kwargs):
if 'created' in kwargs:
if kwargs['created'] and instance.published:
send_mail('Subject here',[sender, instance.published,
args, kwargs,], 'from@example.com', ['to@example.com'],
fail_silently=False)
post_save.connect(send_creation,sender=Gallery)
this works when in the gallery application, however... this is just a
test case, eventually i am going to be hitting up the fb graph api and
posting the website's facebook profile, and i'd prefer to keep the
gallery application useful for both facebook and non-facebook
integrated websites.
I've attempted import signals and import signals.signals in the
website_project __init__.py. the former resulting in nothing and the
latter resulting in a "internal server failure" upon restart.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment