diff options
author | Nishanth Amuluru | 2011-01-05 22:30:45 +0530 |
---|---|---|
committer | Nishanth Amuluru | 2011-01-05 22:30:45 +0530 |
commit | dfc9b3caf56c119d10c002c321a8fcd1d7ff8406 (patch) | |
tree | 7269db834ceff1448d3586c6d421767e64ea79cf /taskapp | |
parent | 5323d98a3650222a96fdf19110280991e08b68e8 (diff) | |
download | pytask-dfc9b3caf56c119d10c002c321a8fcd1d7ff8406.tar.gz pytask-dfc9b3caf56c119d10c002c321a8fcd1d7ff8406.tar.bz2 pytask-dfc9b3caf56c119d10c002c321a8fcd1d7ff8406.zip |
Replaced the word credit with pynt
--HG--
rename : templates/task/assigncredits.html => templates/task/assignpynts.html
Diffstat (limited to 'taskapp')
-rw-r--r-- | taskapp/events/task.py | 12 | ||||
-rw-r--r-- | taskapp/forms/task.py | 6 | ||||
-rw-r--r-- | taskapp/forms/user.py | 2 | ||||
-rw-r--r-- | taskapp/management/commands/seed_db.py | 4 | ||||
-rw-r--r-- | taskapp/models.py | 6 | ||||
-rw-r--r-- | taskapp/utilities/notification.py | 12 | ||||
-rw-r--r-- | taskapp/views/task.py | 54 |
7 files changed, 48 insertions, 48 deletions
diff --git a/taskapp/events/task.py b/taskapp/events/task.py index ef68082..77ad361 100644 --- a/taskapp/events/task.py +++ b/taskapp/events/task.py @@ -106,8 +106,8 @@ def addReviewer(task,reviewer): task.save() return task -def createTask(title,desc,created_by,credits): - """ creates a bare minimum task with title, description and credits. +def createTask(title,desc,created_by,pynts): + """ creates a bare minimum task with title, description and pynts. the creator of the task will be assigned as a reviewer for the task. """ @@ -128,7 +128,7 @@ def createTask(title,desc,created_by,credits): task.id = id task.desc = desc task.created_by = created_by - task.credits = credits + task.pynts = pynts task.creation_datetime = datetime.now() task.published_datetime = datetime.now() task.save() @@ -165,7 +165,7 @@ def assignTask(task, added_user, assigned_by): create_notification("AU", added_user, assigned_by, task=task) -def updateTask(task, title=None, desc=None, credits=None, tags_field=None): +def updateTask(task, title=None, desc=None, pynts=None, tags_field=None): """ update the property accordingly. while updating title, check for uniqueness of title. return None if any error. @@ -178,7 +178,7 @@ def updateTask(task, title=None, desc=None, credits=None, tags_field=None): except Task.IntegrityError: return None if desc:task.desc = desc - if credits:task.credits = credits + if pynts:task.pynts = pynts if tags_field:task.tags_field = tags_field task.save() return task @@ -204,7 +204,7 @@ def removeUser(main_task, rem_user, removed_by, reason=None): create_notification("RU", rem_user, removed_by, task=main_task, remarks=reason) ## TODO : create notification to the victim -def assignCredits(task, given_by, given_to, points): +def assignPynts(task, given_by, given_to, points): """ make a proper request object. """ diff --git a/taskapp/forms/task.py b/taskapp/forms/task.py index 6719f30..f76bfd5 100644 --- a/taskapp/forms/task.py +++ b/taskapp/forms/task.py @@ -4,7 +4,7 @@ from pytask.taskapp.models import Task class TaskCreateForm(forms.ModelForm): class Meta: model = Task - fields = ['title', 'desc', 'tags_field', 'credits'] + fields = ['title', 'desc', 'tags_field', 'pynts'] #publish = forms.BooleanField(required=False) def clean_title(self): @@ -25,7 +25,7 @@ class TaskCreateForm(forms.ModelForm): class EditTaskForm(forms.ModelForm): class Meta: model = Task - fields = ['title', 'desc', 'tags_field', 'credits'] + fields = ['title', 'desc', 'tags_field', 'pynts'] def clean_desc(self): data = self.cleaned_data['desc'].strip() @@ -85,7 +85,7 @@ def AddTaskForm(task_choices, is_plain=False): task = forms.ChoiceField(choices=task_choices) return myForm() -def AssignCreditForm(choices, instance=None): +def AssignPyntForm(choices, instance=None): class myForm(forms.Form): user = forms.ChoiceField(choices=choices, required=True) diff --git a/taskapp/forms/user.py b/taskapp/forms/user.py index 5a8acaa..4cde155 100644 --- a/taskapp/forms/user.py +++ b/taskapp/forms/user.py @@ -16,7 +16,7 @@ class UserProfileEditForm(forms.ModelForm): class Meta: model = Profile - exclude = ('user','rights','dob','credits') + exclude = ('user','rights','dob','pynts') def clean_photo(self): uploaded_photo = self.data.get('photo', None) diff --git a/taskapp/management/commands/seed_db.py b/taskapp/management/commands/seed_db.py index c13abda..97263d5 100644 --- a/taskapp/management/commands/seed_db.py +++ b/taskapp/management/commands/seed_db.py @@ -43,9 +43,9 @@ def seed_db(): title = "Task "+str(i) desc = "I am "+title created_by = defaultReviewer - credits = 20 + pynts = 20 - task = taskEvents.createTask(title,desc,created_by,credits) + task = taskEvents.createTask(title,desc,created_by,pynts) if task: taskEvents.addReviewer(task, defaultReviewer) if i%2==0:taskEvents.publishTask(task) diff --git a/taskapp/models.py b/taskapp/models.py index 8df5dc8..173a5df 100644 --- a/taskapp/models.py +++ b/taskapp/models.py @@ -30,7 +30,7 @@ NOTIFY_CHOICES = ( ("DV", "Developer"), ("MG", "Manager"), ("AD", "Admin"), - ("PY", "Assign credits"), + ("PY", "Assign pynts"), ("CM", "Task completed"), ("CD", "Task closed"), ("DL", "Task deleted"), @@ -70,7 +70,7 @@ class Profile(models.Model): dob = models.DateField(verbose_name = u"Date of Birth", help_text = "YYYY-MM-DD") gender = models.CharField(max_length = 1, choices = GENDER_CHOICES) rights = models.CharField(max_length = 2, choices = RIGHTS_CHOICES, default = u"CT") - credits = models.PositiveSmallIntegerField(default = 0) + pynts = models.PositiveSmallIntegerField(default = 0) aboutme = models.TextField(blank = True) foss_comm = TagField(verbose_name="FOSS Communities") @@ -94,7 +94,7 @@ class Task(models.Model): status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP") tags_field = TagField(verbose_name = u"Tags", help_text = u"Give comma seperated tags") - credits = models.PositiveSmallIntegerField(help_text = u"No.of credits a user gets on completing the task") + pynts = models.PositiveSmallIntegerField(help_text = u"No.of pynts a user gets on completing the task") progress = models.PositiveSmallIntegerField(default = 0) reviewers = models.ManyToManyField(User, related_name = "%(class)s_reviewers") diff --git a/taskapp/utilities/notification.py b/taskapp/utilities/notification.py index da6e6d0..4d67c11 100644 --- a/taskapp/utilities/notification.py +++ b/taskapp/utilities/notification.py @@ -13,7 +13,7 @@ def create_notification(role, sent_to, sent_from=None, reply=None, task=None, re reply: A boolean task: a task if applicable requested_by: a user makes the request - A reviewer who assigns credits in case of pynts + A reviewer who assigns pynts in case of pynts A reviewer who requests to act as a reviewer remarks: any remarks for rejecting receiving_user: user receiving pynts @@ -32,18 +32,18 @@ def create_notification(role, sent_to, sent_from=None, reply=None, task=None, re notification.pynts = pynts task_url= '<a href="/task/view/tid=%s">%s</a>'%(task.id, task.title) - credits_url = '<a href="/task/assigncredits/tid=%s">%s</a>'%(task.id, "click here") + pynts_url = '<a href="/task/assignpynts/tid=%s">%s</a>'%(task.id, "click here") reviewer_url = '<a href="/user/view/uid=%s">%s</a>'%(requested_by.id, requested_by.username) admin_url = '<a href="/user/view/uid=%s">%s</a>'%(sent_from.id, sent_from.username) user_url = '<a href="/user/view/uid=%s">%s</a>'%(receiving_user.id, receiving_user.username) if reply: - notification.sub = "Approved request for assign of credits for %s"%task.title[:20] + notification.sub = "Approved request for assign of pynts for %s"%task.title[:20] notification.message = """ Request made by %s to assign %s pynts to %s for the task %s has been approved by %s<br /> - %s if you want the view/assign pynts page of the task.<br />"""%(reviewer_url, pynts, user_url, task_url, admin_url, credits_url) + %s if you want the view/assign pynts page of the task.<br />"""%(reviewer_url, pynts, user_url, task_url, admin_url, pynts_url) else: - notification.sub = "Rejected request for assign of credits for %s"%task.title[:20] + notification.sub = "Rejected request for assign of pynts for %s"%task.title[:20] notification.message = """ Request made by %s to assign %s pynts to %s for the task %s has been rejected by %s.<br /> """%(reviewer_url, pynts, user_url, task_url, admin_url) if remarks: notification.remarks = remarks @@ -177,7 +177,7 @@ def create_notification(role, sent_to, sent_from=None, reply=None, task=None, re notification.sub = "Your claim for the task %s accepted."%task.title[:20] notification.message = "You have been selected to work on the task %s by %s.<br />"%(task_url, assigned_by_url) - notification.message += "You can now start working on the task and will be credited by the reviewers for your work.<br />" + notification.message += "You can now start working on the task and will be pynted by the reviewers for your work.<br />" notification.message += " Here is a list of reviewers for the task and their email addresses.<br /> <ul>" for a_reviewer in task.reviewers.all(): diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 2507b73..396ba5d 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -5,8 +5,8 @@ from django.shortcuts import render_to_response, redirect from pytask.taskapp.models import User, Task, Comment, Request, Notification from pytask.taskapp.utilities.task import getTask -from pytask.taskapp.forms.task import TaskCreateForm, AddReviewerForm, AddTaskForm, ChoiceForm, AssignCreditForm, RemoveUserForm, EditTaskForm, ClaimTaskForm -from pytask.taskapp.events.task import createTask, reqReviewer, publishTask, addSubTask, addDep, addClaim, assignTask, updateTask, removeTask, removeUser, assignCredits, completeTask, closeTask, addReviewer, deleteTask +from pytask.taskapp.forms.task import TaskCreateForm, AddReviewerForm, AddTaskForm, ChoiceForm, AssignPyntForm, RemoveUserForm, EditTaskForm, ClaimTaskForm +from pytask.taskapp.events.task import createTask, reqReviewer, publishTask, addSubTask, addDep, addClaim, assignTask, updateTask, removeTask, removeUser, assignPynts, completeTask, closeTask, addReviewer, deleteTask from pytask.taskapp.views.user import show_msg from pytask.taskapp.utilities.user import get_user @@ -113,7 +113,7 @@ def view_task(request, tid): context['can_mod_reviewers'] = True if task.status in ["UP", "OP", "LO", "WR"] and is_reviewer else False context['can_mod_tasks'] = True if task.status in ["UP", "OP", "LO"] and is_reviewer else False - context['can_assign_credits'] = True if task.status in ["OP", "WR"] and is_reviewer else False + context['can_assign_pynts'] = True if task.status in ["OP", "WR"] and is_reviewer else False context['task_claimable'] = True if task.status in ["OP", "WR"] and not is_guest else False if task.status == "CD": @@ -156,9 +156,9 @@ def create_task(request): data = form.cleaned_data title = data['title'] desc = data['desc'] - credits = data['credits'] + pynts = data['pynts'] #publish = data['publish'] # just in case if we have to show the option - task = createTask(title,desc,user,credits) + task = createTask(title,desc,user,pynts) addReviewer(task, user) updateTask(task,tags_field=data['tags_field']) @@ -486,11 +486,11 @@ def assign_task(request, tid): else: return show_msg(user, 'You are not authorised to perform this action', task_url, 'view the task') -def assign_credits(request, tid): - """ Check if the user is a reviewer and credits can be assigned. - Then display all the approved credits. - Then see if reviewer can assign credits to users also or only reviewers. - Then put up a form for reviewer to assign credits accordingly. +def assign_pynts(request, tid): + """ Check if the user is a reviewer and pynts can be assigned. + Then display all the approved pynts. + Then see if reviewer can assign pynts to users also or only reviewers. + Then put up a form for reviewer to assign pynts accordingly. """ task_url = "/task/view/tid=%s"%tid @@ -498,8 +498,8 @@ def assign_credits(request, tid): user = get_user(request.user) if request.user.is_authenticated() else request.user task = getTask(tid) - ## the moment we see that user had requested credits, it means he had worked and hence we change the status to WR - ## we have to discuss on this since, credits may also be given to reviewer + ## the moment we see that user had requested pynts, it means he had worked and hence we change the status to WR + ## we have to discuss on this since, pynts may also be given to reviewer task.status = "WR" task.save() @@ -511,35 +511,35 @@ def assign_credits(request, tid): choices = [(_.id,_.username) for _ in task.reviewers.all()] if task.status == "WR": choices.extend([(_.id, _.username) for _ in task.assigned_users.all() ]) - prev_credits = task.request_task.filter(role="PY",is_valid=True,is_replied=True,reply=True).count() - credit_requests = task.request_task.filter(role="PY",is_valid=True).order_by('creation_date').reverse() - form = AssignCreditForm(choices) + prev_pynts = task.request_task.filter(role="PY",is_valid=True,is_replied=True,reply=True).count() + pynt_requests = task.request_task.filter(role="PY",is_valid=True).order_by('creation_date').reverse() + form = AssignPyntForm(choices) context = { 'user':user, 'task':task, - 'prev_credits':prev_credits, - 'credit_requests':credit_requests, + 'prev_pynts':prev_pynts, + 'pynt_requests':pynt_requests, 'form':form, } if request.method == "POST": data = request.POST - form = AssignCreditForm(choices, data) + form = AssignPyntForm(choices, data) if form.is_valid(): data = form.cleaned_data uid = data['user'] points = data['pynts'] given_to = User.objects.get(id=uid) - assignCredits(task=task, given_by=user, given_to=given_to, points=points) - return redirect('/task/assigncredits/tid=%s'%task.id) + assignPynts(task=task, given_by=user, given_to=given_to, points=points) + return redirect('/task/assignpynts/tid=%s'%task.id) else: context['form'] = form - return render_to_response('task/assigncredits.html', context) + return render_to_response('task/assignpynts.html', context) else: - return render_to_response('task/assigncredits.html', context) + return render_to_response('task/assignpynts.html', context) else: - return show_msg(user, "Credits cannot be assigned at this stage", task_url, "view the task") + return show_msg(user, "Pynts cannot be assigned at this stage", task_url, "view the task") else: return show_msg(user, "You are not authorised to perform this action", task_url, "view the task") @@ -587,8 +587,8 @@ def complete_task(request, tid): claimed_users = task.claimed_users.all() assigned_users = task.assigned_users.all() - assign_credits_url = '/task/assigncredits/tid=%s'%task.id - task_assigned_credits = task.credit_set.all() + assign_pynts_url = '/task/assignpynts/tid=%s'%task.id + task_assigned_pynts = task.pynt_set.all() if is_reviewer: @@ -599,14 +599,14 @@ def complete_task(request, tid): 'task':task, } - if task_assigned_credits: + if task_assigned_pynts: if request.method=="POST": completeTask(task, user) return redirect(task_url) else: return render_to_response('task/complete.html', context) else: - return show_msg(user, "Nobody has been credited for doing this task.", assign_credits_url, "assign credits") + return show_msg(user, "Nobody has been pynted for doing this task.", assign_pynts_url, "assign pynts") else: return show_msg(user, "The task cannot be marked as completed at this stage", task_url, "view the task") else: |