def home(req): viewitems = { 'title': 'Home', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), } return redirect('category')
def get(self, req): viewitems = { 'title': 'Profile Information', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), 'user': req.user } return render(req, 'gst/user.html', viewitems)
def get(self, req, category): viewitems = { 'title': 'Category Edit', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), 'category': req.user.category_set.get(id=category) } return render(req, 'gst/category_edit.html', viewitems)
def get(self, req): viewitems = { 'title': 'Categories', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), 'categories': req.user.category_set.all() } return render(req, 'gst/category.html', viewitems)
def get(self, req, category): viewitems = { 'title': 'Tareas', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), 'category': req.user.category_set.get(id=category), 'tasks': req.user.category_set.get(id=category).task_set.all() } return render(req, 'gst/task.html', viewitems)
def get(self, req, category, task): viewitems = { 'title': 'Editar Tarea', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), 'category': req.user.category_set.get(id=category), 'task': req.user.category_set.get(id=category).task_set.get(id=task), } return render(req, 'gst/task_edit.html', viewitems)
def get(self, req): viewitems = { 'title': 'About', 'username': req.user.username if req.user.username else None, 'number_deadlines': number_deadlines_from_user(req.user) if req.user.username else None, } return render(req, 'gst/about.html', viewitems)
def get(self, req, category, task): viewitems = { 'title': 'Sub Tareas', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), 'category': req.user.category_set.get(id=category), 'task': req.user.category_set.get(id=category).task_set.get(id=task), 'subtasks': req.user.category_set.get(id=category) .task_set.get(id=task).subtask_set.all(), 'comments': req.user.category_set.get(id=category) .task_set.get(id=task).comment_set.all(), } return render(req, 'gst/subtask.html', viewitems)
def post(self, req): name = req.POST['name'] try: req.user.category_set.get(name=name) viewitems = { 'title': 'Categories', 'username': req.user.username, 'number_deadlines': number_deadlines_from_user(req.user), 'categories': req.user.category_set.all(), 'error': 'La categoría ya existe. No pueden haber duplicados.' } return render(req, 'gst/category.html', viewitems) except Category.DoesNotExist: req.user.category_set.create(name=name) return redirect('task', category=req.user.category_set.get(name=name).id)