def send_notification(sender, instance, raw, created, **kwargs): if instance.status == PLAYLIST_STATUS_WAITING_FOR_MODERATION: from localtv.models import SiteLocation from localtv.util 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_notification(sender, instance, raw, created, **kwargs): if instance.status == PLAYLIST_STATUS_WAITING_FOR_MODERATION: from localtv.models import SiteLocation from localtv.util 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): sitelocation = models.SiteLocation.objects.get_current() previous = datetime.datetime.now() - delta queue_videos = models.Video.objects.filter( site=sitelocation.site, status=models.VIDEO_STATUS_UNAPPROVED) new_videos = queue_videos.filter(when_submitted__gte=previous) if new_videos.count(): subject = 'Video Submissions for %s' % sitelocation.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': sitelocation.site}) message = t.render(c) util.send_notice(notice_type, subject, message, sitelocation=sitelocation)
def send_email(self, delta, time_period, notice_type): sitelocation = models.SiteLocation.objects.get_current() previous = datetime.datetime.now() - delta queue_videos = models.Video.objects.filter( site=sitelocation.site, status=models.VIDEO_STATUS_UNAPPROVED, feed=None, search=None) new_videos = queue_videos.filter(when_submitted__gte=previous) if new_videos.count(): subject = 'Video Submissions for %s' % sitelocation.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': sitelocation.site}) message = t.render(c) util.send_notice(notice_type, subject, message, sitelocation=sitelocation)