# HG changeset patch # User anoop # Date 1266915714 -19800 # Node ID 67e0d0a915e33ecdd5c8d89e0b35c4e15dc66c19 # Parent 05e10eccd515cc4b4202fa29bd091b2bebbe145b added utilities for creating notification. diff -r 05e10eccd515 -r 67e0d0a915e3 taskapp/admin.py --- a/taskapp/admin.py Tue Feb 23 13:14:18 2010 +0530 +++ b/taskapp/admin.py Tue Feb 23 14:31:54 2010 +0530 @@ -1,9 +1,10 @@ from django.contrib import admin -from pytask.taskapp.models import Profile, Task, Credit, Comment, Claim +from pytask.taskapp.models import Profile, Task, Credit, Comment, Claim, Notification admin.site.register(Profile) admin.site.register(Task) admin.site.register(Comment) admin.site.register(Credit) admin.site.register(Claim) +admin.site.register(Notification) diff -r 05e10eccd515 -r 67e0d0a915e3 taskapp/utilities/__init__.py diff -r 05e10eccd515 -r 67e0d0a915e3 taskapp/utilities/notification.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/taskapp/utilities/notification.py Tue Feb 23 14:31:54 2010 +0530 @@ -0,0 +1,16 @@ +from pytask.taskapp.models import Notification +from datetime import datetime + +def create_notification(to,subject,message): + """ + creates a notification based on the passed arguments. + to - a list of users to which the notification is to be sent + subject - subject of the notification message to be sent + message - message body of the notification + """ + notification = Notification(sent_date = datetime.now()) + notification.save() + notification.to = to + notification.sub = subject + notification.message = message + notification.save()