def view_task(request, username, task_id): task = get_object_or_404(TaskModels.Task, tasklist__user__username=username, _id=task_id) if not task.has_view_permission(request.user.pk): return HttpResponseRedirect(reverse('home')) history = EventUtils._get_history(task) edit_permission = task.has_edit_permission(request.user.pk) return render(request, "task/view.html", {"task": task, "history": history, "edit_permission": edit_permission})
def modified_by(self): try: return EventUtils._get_history(self).reverse()[0].user except IndexError: return None
def created_by(self): try: return EventUtils._get_history(self)[0].user except IndexError: return None