def bug_report_saved(sender, **kwargs): """ A signal receiver which fires after a BugReport is saved. It is used to add an admin notification that there has been a new bug report. """ created = kwargs.get('created') if created: bug_report = kwargs.get('instance') notification = AdminNotification( message=u'A new bug report has been filed.', handle_url=urlresolvers.reverse('admin:contact_bugreport_change', args=(bug_report.id,)), app_name='contact') notification.save()
def send_admin_notification(message, handle_url): notification = AdminNotification(message=message, handle_url=handle_url, app_name='distance_learning') notification.save()