def contentChanged(sender, **kwargs): item = kwargs['instance'] if kwargs['created']: changetype = 'added' else: changetype = 'modified' editing_user = CurrentUser().programmer if editing_user is None: editing_user = '******' l = LogItem( logtext='%s "%s" %s by %s.' % (item._meta.object_name, item.prettyLink(), changetype, editing_user)) l.save() message = '''%s "%s" has been %s on the website by %s. ''' % ( item._meta.object_name, item, changetype, editing_user, ) send_mail( 'Website Change: "%s", %s' % ( item, changetype, ), message, '*****@*****.**', [ settings.NOTIFICATIONS_RECIPIENT, ], fail_silently=False, )
def eventUnapproved(sender, **kwargs): approval = kwargs['instance'] try: event = approval.event editing_user = CurrentUser().programmer if editing_user is None: l = LogItem(logtext='%s unapproved by unknown: %s %s' % ( event.typeName, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) else: l = LogItem(logtext='%s unapproved by %s: %s %s' % ( event.typeName, editing_user.get_link, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) l.save() message = '''A %s has been UNAPPROVED on the website by %s: %s %s http://www.starandshadow.org.uk%s ''' % ( event.typeName, editing_user.name, event.listHeading, event.startDateTime.strftime('%Y/%m/%d, %H:%M'), event.get_absolute_url(), ) send_mail( 'S&S Website Change: %s, %s approval deleted by %s' % ( event.startDateTime.strftime('%Y/%m/%d, %H:%M'), event.title, editing_user.name), message, '*****@*****.**', [settings.NOTIFICATIONS_RECIPIENT, ], fail_silently=False, ) except IndexError: pass
def programmeChanged(sender, **kwargs): event = kwargs['instance'] #print kwargs['update_fields'] TODO: When Django 1.5 is released we can make use of this to distinguish between approvals and other changes. if kwargs['created']: changetype = 'added' else: changetype = 'modified' editing_user = CurrentUser().programmer if editing_user is None: l = LogItem(logtext='%s %s by unknown: %s %s' % ( event.typeName, changetype, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) else: l = LogItem(logtext='%s %s by %s: %s %s' % (event.typeName, changetype, editing_user.get_link, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) l.save()
def contentChanged(sender, **kwargs): item = kwargs['instance'] if kwargs['created']: changetype = 'added' else: changetype = 'modified' editing_user = CurrentUser().programmer if editing_user is None: editing_user = '******' l = LogItem(logtext='%s "%s" %s by %s.' % (item._meta.object_name, item.prettyLink(), changetype, editing_user)) l.save() message = '''%s "%s" has been %s on the website by %s. ''' % ( item._meta.object_name, item, changetype, editing_user, ) send_mail('Website Change: "%s", %s' % (item, changetype, ), message, '*****@*****.**', [settings.NOTIFICATIONS_RECIPIENT, ], fail_silently=False, )
def programmeChanged(sender, **kwargs): event = kwargs['instance'] #print kwargs['update_fields'] TODO: When Django 1.5 is released we can make use of this to distinguish between approvals and other changes. if kwargs['created']: changetype = 'added' else: changetype = 'modified' editing_user = CurrentUser().programmer if editing_user is None: l = LogItem(logtext='%s %s by unknown: %s %s' % (event.typeName, changetype, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) else: l = LogItem( logtext='%s %s by %s: %s %s' % (event.typeName, changetype, editing_user.get_link, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) l.save()
def eventApproved(sender, **kwargs): approval = kwargs['instance'] if not kwargs['created']: try: event = approval.event editing_user = CurrentUser().programmer if editing_user is None: l = LogItem(logtext='%s approved by unknown: %s %s' % (event.typeName, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) else: l = LogItem( logtext='%s approved by %s: %s %s' % (event.typeName, editing_user.get_link, event.get_link, event.startDateTime.strftime('%Y/%m/%d, %H:%M'))) l.save() message = '''A %s has been APPROVED on the website by %s: %s %s http://www.starandshadow.org.uk%s ''' % ( event.typeName, editing_user.name, event.listHeading, event.startDateTime.strftime('%Y/%m/%d, %H:%M'), event.get_absolute_url(), ) send_mail( 'S&S Website Change: %s, %s approved added by %s' % (event.startDateTime.strftime('%Y/%m/%d, %H:%M'), event.title, editing_user.name), message, '*****@*****.**', [ settings.NOTIFICATIONS_RECIPIENT, ], fail_silently=False, ) except IndexError: pass