Пример #1
0
def videos():
    videos1 = []
    videos2 = []
    #<a href="{% url recipient video1r.slug %}">{{ video1r.name }}</a></p>
    #<p>How ProcrasDonate Works</p>
    pd = Recipient.get_or_none(slug='PD')
    if pd:
        if pd.promotional_video:
            videos2.append({'video': pd.promotional_video,
                            'caption': 'ProcrasDonate: Early Presentation'})
        videos2.append({'video': "%sswf/LaptopIntro.swf" % settings.MEDIA_URL,
                        'caption': 'ProcrasDonate Intro'})
    for ch in Recipient.objects.filter(is_visible=True, tax_exempt_status=True):
        if ch.promotional_video:
            videos1.append({'video': ch.promotional_video,
                            'caption': '<a href="%s">%s</a>' % (reverse('recipient',
                                                                        args=(ch.slug, )),
                                                                ch.name)})
        if ch.pd_experience_video:
            videos2.append({'video': ch.pd_experience_video,
                            'caption': '<a href="%s">%s\'s Experience with ProcrasDonate</a>' % (reverse('recipient',
                                                                                                             args=(ch.slug, )),
                                                                                                    ch.name)})
            
    video1 = None
    video2 = None
    if videos1:
        video1 = videos1[randint(0, len(videos1)-1)]
    if videos2:
        video2 = videos2[randint(0, len(videos2)-1)]
    
    return {'video1': video1,
            'video2': video2}
Пример #2
0
def videos():
    videos1 = []
    videos2 = []
    #<a href="{% url recipient video1r.slug %}">{{ video1r.name }}</a></p>
    #<p>How ProcrasDonate Works</p>
    pd = Recipient.get_or_none(slug='PD')
    if pd:
        if pd.promotional_video:
            videos2.append({
                'video': pd.promotional_video,
                'caption': 'ProcrasDonate: Early Presentation'
            })
        videos2.append({
            'video': "%sswf/LaptopIntro.swf" % settings.MEDIA_URL,
            'caption': 'ProcrasDonate Intro'
        })
    for ch in Recipient.objects.filter(is_visible=True,
                                       tax_exempt_status=True):
        if ch.promotional_video:
            videos1.append({
                'video':
                ch.promotional_video,
                'caption':
                '<a href="%s">%s</a>' %
                (reverse('recipient', args=(ch.slug, )), ch.name)
            })
        if ch.pd_experience_video:
            videos2.append({
                'video':
                ch.pd_experience_video,
                'caption':
                '<a href="%s">%s\'s Experience with ProcrasDonate</a>' %
                (reverse('recipient', args=(ch.slug, )), ch.name)
            })

    video1 = None
    video2 = None
    if videos1:
        video1 = videos1[randint(0, len(videos1) - 1)]
    if videos2:
        video2 = videos2[randint(0, len(videos2) - 1)]

    return {'video1': video1, 'video2': video2}
Пример #3
0
    def remove(self, recipient_emails):
        '''Removes all the recipient in the given list from the database.
        
        Arguments:
            recipient_emails {list} -- The list of recipient emails.
        '''
        self.__logger.info(f'Removing {len(recipient_emails)} recipients.')

        for email in recipient_emails:

            recipient = Recipient.get_or_none(Recipient.email == email.strip())

            if recipient:

                recipient.delete_instance()

            else:

                self.__logger.warning(
                    f'Recipient {email} was not in the database.'
                )