コード例 #1
0
ファイル: admin.py プロジェクト: ErdeleB/djangopeoplenet
 def changelist_view(self, request, extra_context=None, **kwargs):
     if extra_context is None:
         extra_context = {}
     extra_context['users_to_welcome'] = WelcomeEmail.get_users_to_welcome()
     return super(WelcomeEmailAdmin,
                  self).changelist_view(request,
                                        extra_context=extra_context,
                                        **kwargs)
コード例 #2
0
ファイル: views.py プロジェクト: minrivertea/kungfupeople
def create_welcome_emails(request):
    """figure out what people to send welcome emails to and then send them.
    The people to consider for this is those who haven't received an email 
    and are younger than a day.
    """
    
    users = WelcomeEmail.get_users_to_welcome()
    
    count = 0
    for user in users:
        welcome_email = create_welcome_email(user, request)
        if welcome_email is not None:
            count += 1
        
    if count:
        if count == 1:
            msg = 'Created 1 welcome email'
        else:
            msg = 'Created %s welcome emails' % count
    else:
        msg = 'No welcome emails this time'
    return HttpResponse(msg)
コード例 #3
0
ファイル: views.py プロジェクト: ErdeleB/djangopeoplenet
def create_welcome_emails(request):
    """figure out what people to send welcome emails to and then send them.
    The people to consider for this is those who haven't received an email 
    and are younger than a day.
    """

    users = WelcomeEmail.get_users_to_welcome()

    count = 0
    for user in users:
        welcome_email = create_welcome_email(user, request)
        if welcome_email is not None:
            count += 1

    if count:
        if count == 1:
            msg = 'Created 1 welcome email'
        else:
            msg = 'Created %s welcome emails' % count
    else:
        msg = 'No welcome emails this time'
    return HttpResponse(msg)
コード例 #4
0
ファイル: admin.py プロジェクト: peterbe/djangopeoplenet
 def changelist_view(self, request, extra_context=None, **kwargs):
     if extra_context is None:
         extra_context = {}
     extra_context["users_to_welcome"] = WelcomeEmail.get_users_to_welcome()
     return super(WelcomeEmailAdmin, self).changelist_view(request, extra_context=extra_context, **kwargs)