本文整理匯總了Python中rapidsms_httprouter.models.Message.__subclasses__方法的典型用法代碼示例。如果您正苦於以下問題:Python Message.__subclasses__方法的具體用法?Python Message.__subclasses__怎麽用?Python Message.__subclasses__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rapidsms_httprouter.models.Message
的用法示例。
在下文中一共展示了Message.__subclasses__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: sites_postsave_handler
# 需要導入模塊: from rapidsms_httprouter.models import Message [as 別名]
# 或者: from rapidsms_httprouter.models.Message import __subclasses__ [as 別名]
def sites_postsave_handler(sender, **kwargs):
if 'django.contrib.sites' in settings.INSTALLED_APPS:
if ((sender == Contact or sender in Contact.__subclasses__()) and kwargs['created']):
ContactSite.objects.create(contact=kwargs['instance'], site=Site.objects.get_current())
elif ((sender == User or sender in User.__subclasses__()) and kwargs['created']):
UserSite.objects.create(user=kwargs['instance'], site=Site.objects.get_current())
elif ((sender == Group or sender in Group.__subclasses__()) and kwargs['created']):
GroupSite.objects.create(group=kwargs['instance'], site=Site.objects.get_current())
# elif (sender == Connection and kwargs['created']):
# ConnectionSite.objects.create(connection = kwargs['instance'], site=Site.objects.get_current())
elif ((sender == Message or sender in Message.__subclasses__()) and kwargs['created']):
MessageSite.objects.create(message=kwargs['instance'], site=Site.objects.get_current())