diff options
author | anoop | 2010-02-23 14:31:54 +0530 |
---|---|---|
committer | anoop | 2010-02-23 14:31:54 +0530 |
commit | 34ddb90df32f71cb3dcae2b024789848823ba622 (patch) | |
tree | dd7ab4d99d2730ea78988b643aa4eb916c66af57 | |
parent | e2d8393f8aabe414879bb8b4b7f2910a0c6b8e00 (diff) | |
download | pytask-34ddb90df32f71cb3dcae2b024789848823ba622.tar.gz pytask-34ddb90df32f71cb3dcae2b024789848823ba622.tar.bz2 pytask-34ddb90df32f71cb3dcae2b024789848823ba622.zip |
added utilities for creating notification.
-rw-r--r-- | taskapp/admin.py | 3 | ||||
-rw-r--r-- | taskapp/utilities/__init__.py | 0 | ||||
-rw-r--r-- | taskapp/utilities/notification.py | 16 |
3 files changed, 18 insertions, 1 deletions
diff --git a/taskapp/admin.py b/taskapp/admin.py index 62dc766..6881372 100644 --- a/taskapp/admin.py +++ b/taskapp/admin.py @@ -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 --git a/taskapp/utilities/__init__.py b/taskapp/utilities/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/taskapp/utilities/__init__.py diff --git a/taskapp/utilities/notification.py b/taskapp/utilities/notification.py new file mode 100644 index 0000000..816e8bf --- /dev/null +++ b/taskapp/utilities/notification.py @@ -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() |