summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornishanth2010-02-04 22:30:30 +0530
committernishanth2010-02-04 22:30:30 +0530
commit2065926b78e6e95e9e8dc4513eb6578cdba06c45 (patch)
tree9f428495c21a02ca6bd1d5963afe27e16133c40a
parenta7eb099e1c73545217babeef9dc52e6abb2ba912 (diff)
downloadpytask-2065926b78e6e95e9e8dc4513eb6578cdba06c45.tar.gz
pytask-2065926b78e6e95e9e8dc4513eb6578cdba06c45.tar.bz2
pytask-2065926b78e6e95e9e8dc4513eb6578cdba06c45.zip
added events/task.py and templates/error.html.
-rw-r--r--taskapp/events/task.py34
-rw-r--r--templates/error.html7
2 files changed, 41 insertions, 0 deletions
diff --git a/taskapp/events/task.py b/taskapp/events/task.py
new file mode 100644
index 0000000..c887a3c
--- /dev/null
+++ b/taskapp/events/task.py
@@ -0,0 +1,34 @@
+from datetime import datetime
+from pytask.taskapp.models import Profile, Task, Comment, Credit
+
+def publishTask(task):
+ """ set the task status to open """
+
+ task.status = "OP"
+ task.save()
+ return task
+
+def addMentor(task,mentor):
+ """ add the mentor to mentors list of the task """
+
+ task.mentors.add(mentor)
+ task.save()
+ return task
+
+def createTask(title,desc,created_by,credits):
+ """ creates a bare minimum task with title, description and credits.
+ the creator of the task will be assigned as a mentor for the task.
+ """
+
+ try:
+ task = Task.objects.get(title=title)
+ return None
+ except Task.DoesNotExist:
+ task = Task(title=title)
+ task.desc = desc
+ task.created_by = created_by
+ task.credits = credits
+ task.creation_datetime = datetime.now()
+ task.save()
+ return task
+
diff --git a/templates/error.html b/templates/error.html
new file mode 100644
index 0000000..ccc65fe
--- /dev/null
+++ b/templates/error.html
@@ -0,0 +1,7 @@
+{% extends 'base.html' %}
+{% block content %}
+ {% if error_msg %}
+ {{error_msg}}<br />
+ <a href="/">click here</a> to return to Homepage
+ {% endif %}
+{% endblock %}