def send_email(self, delta, time_period, notice_type): site_settings = SiteSettings.objects.get_current() previous = datetime.datetime.now() - delta queue_videos = Video.objects.filter( status=Video.UNAPPROVED, site=site_settings.site, ) new_videos = queue_videos.filter(when_submitted__gte=previous) if new_videos.count(): subject = 'Video Submissions for %s' % site_settings.site.name t = loader.get_template( 'localtv/submit_video/review_status_email.txt') c = Context({ 'new_videos': new_videos, 'queue_videos': queue_videos, 'time_period': time_period, 'site': site_settings.site }) message = t.render(c) utils.send_notice(notice_type, subject, message, site_settings=site_settings)
def send_notification(sender, instance, raw, created, **kwargs): if instance.status == Playlist.WAITING_FOR_MODERATION: from localtv.models import SiteLocation from localtv.utils import send_notice sitelocation = SiteLocation.objects.get_current() t = loader.get_template('localtv/playlists/notification_email.txt') c = Context({ 'playlist': instance, 'sitelocation': sitelocation}) subject = '[%s] %s asked for a playlist to be public: %s' % ( sitelocation.site.name, instance.user.username, instance.name) message = t.render(c) send_notice('admin_new_playlist', subject, message, sitelocation=SiteLocation.objects.get_current())
def send_email(self, delta, time_period, notice_type): site_settings = SiteSettings.objects.get_current() previous = datetime.datetime.now() - delta queue_videos = Video.objects.filter( status=Video.UNAPPROVED, site=site_settings.site, ) new_videos = queue_videos.filter(when_submitted__gte=previous) if new_videos.count(): subject = 'Video Submissions for %s' % site_settings.site.name t = loader.get_template( 'localtv/submit_video/review_status_email.txt') c = Context({'new_videos': new_videos, 'queue_videos': queue_videos, 'time_period': time_period, 'site': site_settings.site}) message = t.render(c) utils.send_notice(notice_type, subject, message, site_settings=site_settings)