Author: leidel
Date: Wed Jan 21 01:02:32 2009
New Revision: 142
Modified:
wiki/IntegrarNotification.wiki
Log:
Edited wiki page through web user interface.
Modified: wiki/IntegrarNotification.wiki
==============================================================================
--- wiki/IntegrarNotification.wiki (original)
+++ wiki/IntegrarNotification.wiki Wed Jan 21 01:02:32 2009
@@ -19,18 +19,17 @@
{{{
-from django.dispatch import dispatcher
-from django.db.models import signals
+from django.conf import settings
-try:
+if "notification" in settings.INSTALLED_APPS:
from notification import models as notification
-
+
def create_notice_types(app, created_models, verbosity, **kwargs):
notification.create_notice_type("invitacion_amigo", u"Invitación
recibida", u"has recibido una invitación")
notification.create_notice_type("invitacion_aceptada",
u"Invitación aceptada", u"una invitación que enviaste fue aceptada")
- dispatcher.connect(create_notice_types, signal=signals.post_syncdb,
sender=notification)
-except ImportError:
+ signals.post_syncdb.connect(create_notice_types, sender=notification)
+else:
print "No se encontró la aplicación notification, no se crearán
objetos del tipo NoticeTypes"
}}}
@@ -57,10 +56,12 @@
Por ejemplo:
{{{
-try:
- from notification import models as notification
-except ImportError:
- notification = None
+ from django.conf import settings
+
+ if "notification" in settings.INSTALLED_APPS:
+ from notification import models as notification
+ else:
+ notification = None
}}}
y luego:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---