本文整理汇总了Python中emencia.django.newsletter.models.MailingList.subscribers方法的典型用法代码示例。如果您正苦于以下问题:Python MailingList.subscribers方法的具体用法?Python MailingList.subscribers怎么用?Python MailingList.subscribers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类emencia.django.newsletter.models.MailingList
的用法示例。
在下文中一共展示了MailingList.subscribers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_mailinglist
# 需要导入模块: from emencia.django.newsletter.models import MailingList [as 别名]
# 或者: from emencia.django.newsletter.models.MailingList import subscribers [as 别名]
def create_mailinglist(self, request, queryset):
"""Create a mailing list from selected contact"""
when = str(datetime.now()).split('.')[0]
new_mailing = MailingList(
name=_('New mailinglist at %s') % when,
description=_('New mailing list created in admin at %s') % when)
new_mailing.save()
if 'lite' in settings.DATABASES['default']['ENGINE']:
self.message_user(
request,
_('SQLite3 or a SpatialLite database type detected, ' \
'please note you will be limited to 999 contacts ' \
'per mailing list.')
)
try:
new_mailing.subscribers = queryset.all()
except DatabaseError:
new_mailing.subscribers = queryset.none()
if not request.user.is_superuser and USE_WORKGROUPS:
for workgroup in request_workgroups(request):
workgroup.mailinglists.add(new_mailing)
self.message_user(request, _('%s succesfully created.') % new_mailing)
return HttpResponseRedirect(reverse(
'admin:newsletter_mailinglist_change',
args=[new_mailing.pk]
))
示例2: merge_mailinglist
# 需要导入模块: from emencia.django.newsletter.models import MailingList [as 别名]
# 或者: from emencia.django.newsletter.models.MailingList import subscribers [as 别名]
def merge_mailinglist(self, request, queryset):
"""Merge multiple mailing list"""
if queryset.count() == 1:
self.message_user(request, _('Please select a least 2 mailing list.'))
return None
subscribers = {}
unsubscribers = {}
for ml in queryset:
for contact in ml.subscribers.all():
subscribers[contact] = ''
for contact in ml.unsubscribers.all():
unsubscribers[contact] = ''
when = str(datetime.now()).split('.')[0]
new_mailing = MailingList(name=_('Merging list at %s') % when,
description=_('Mailing list created by merging at %s') % when)
new_mailing.save()
new_mailing.subscribers = subscribers.keys()
new_mailing.unsubscribers = unsubscribers.keys()
if not request.user.is_superuser and USE_WORKGROUPS:
for workgroup in request_workgroups(request):
workgroup.mailinglists.add(new_mailing)
self.message_user(request, _('%s succesfully created by merging.') % new_mailing)
return HttpResponseRedirect(reverse('admin:newsletter_mailinglist_change',
args=[new_mailing.pk]))
示例3: create_mailinglist
# 需要导入模块: from emencia.django.newsletter.models import MailingList [as 别名]
# 或者: from emencia.django.newsletter.models.MailingList import subscribers [as 别名]
def create_mailinglist(self, request, queryset):
"""Create a mailing list from selected contact"""
when = str(datetime.now()).split('.')[0]
new_mailing = MailingList(name=_('New mailinglist at %s') % when,
description=_('New mailing list created in admin at %s') % when)
new_mailing.save()
new_mailing.subscribers = queryset.all()
if not request.user.is_superuser and USE_WORKGROUPS:
for workgroup in request_workgroups(request):
workgroup.mailinglists.add(new_mailing)
self.message_user(request, _('%s succesfully created.') % new_mailing)
return HttpResponseRedirect(reverse('admin:newsletter_mailinglist_change',
args=[new_mailing.pk]))
示例4: merge_mailinglist
# 需要导入模块: from emencia.django.newsletter.models import MailingList [as 别名]
# 或者: from emencia.django.newsletter.models.MailingList import subscribers [as 别名]
def merge_mailinglist(self, request, queryset):
"""Merge multiple mailing list"""
if queryset.count() == 1:
self.message_user(request, _('Please select a least 2 mailing list.'))
return None
contacts = {}
for ml in queryset:
for contact in ml.subscribers.all():
contacts[contact] = ''
when = str(datetime.now()).split('.')[0]
new_mailing = MailingList(name=_('Merging list at %s') % when,
description=_('Mailing list created by merging at %s') % when)
new_mailing.save()
new_mailing.subscribers = contacts.keys()
self.message_user(request, _('%s succesfully created by merging.') % new_mailing)
return HttpResponseRedirect(reverse('admin:newsletter_mailinglist_change',
args=[new_mailing.pk,]))