From 54a02f5f02a99f03514ef2364e5cc25c0e34d80b Mon Sep 17 00:00:00 2001 From: Taciano Morais Silva Date: Thu, 12 Nov 2020 09:20:57 -0300 Subject: [PATCH] =?UTF-8?q?Add=20fun=C3=A7=C3=A3o=20detalhar=20tarefa=20#1?= =?UTF-8?q?8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasktracking/tasks/templates/tasks/index.html | 9 ++-- .../templates/tasks/tarefa/detalhar.html | 54 +++++++++++++++++++ tasktracking/tasks/urls.py | 1 + tasktracking/tasks/views.py | 9 +++- 4 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 tasktracking/tasks/templates/tasks/tarefa/detalhar.html diff --git a/tasktracking/tasks/templates/tasks/index.html b/tasktracking/tasks/templates/tasks/index.html index 60e0d3d..8c3ad1e 100644 --- a/tasktracking/tasks/templates/tasks/index.html +++ b/tasktracking/tasks/templates/tasks/index.html @@ -19,9 +19,12 @@ {% for tarefa in lista_tarefas %}
  • - {{tarefa}} - - + {{ tarefa }} + + Lista de Tags (tarefa.tag_set.all) + +
  • {% endfor %} diff --git a/tasktracking/tasks/templates/tasks/tarefa/detalhar.html b/tasktracking/tasks/templates/tasks/tarefa/detalhar.html new file mode 100644 index 0000000..4753935 --- /dev/null +++ b/tasktracking/tasks/templates/tasks/tarefa/detalhar.html @@ -0,0 +1,54 @@ +{% extends "base.html" %} + +{% block titulo %} +PWeb 2020.6 - Detalhar Tarefa +{% endblock %} + +{% block content %} +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Identificador{{ object.identificador }}
    Nome{{ object.nome }}
    Descrição{{ object.descrição }}
    Criação{{ object.criada_em }}
    Fechamento{{ object.fechada_em }}
    Status{{ object.status }}
    Situação{{ object.situacao }}
    Criador{{ object.usuario }}
    Links +
      + {% for link in object.link_set.all %} +
    • {{ link }}
    • + {% endfor %} +
    +
    +
    +{% endblock%} \ No newline at end of file diff --git a/tasktracking/tasks/urls.py b/tasktracking/tasks/urls.py index 0dfaecb..716c04d 100644 --- a/tasktracking/tasks/urls.py +++ b/tasktracking/tasks/urls.py @@ -5,5 +5,6 @@ urlpatterns = [ path('', views.index, name='index'), path('cadastrar_tarefa', views.cadastrar_tarefa, name='cadastrar_tarefa'), + path('detalhar_tarefa//', views.TarefaDetailView.as_view(), name='detalhar_tarefa'), path('cadastrar_link', views.cadastrar_link, name='cadastrar_link'), ] diff --git a/tasktracking/tasks/views.py b/tasktracking/tasks/views.py index fbd6537..d9bfc7b 100644 --- a/tasktracking/tasks/views.py +++ b/tasktracking/tasks/views.py @@ -1,6 +1,7 @@ from django.http import request from django.shortcuts import redirect, render -from tasks.forms import TarefaForm +from django.views.generic import DetailView +from tasks.forms import LinkForm, TarefaForm from tasks.models import Tarefa from tasks.models import Link @@ -32,6 +33,12 @@ def cadastrar_tarefa(request): } return render(request, 'tasks/tarefa/cadastrar_tarefa.html', context=context) + +class TarefaDetailView(DetailView): + model = Tarefa + template_name = 'tasks/tarefa/detalhar.html' + + def cadastrar_link(request): if request.method == 'POST': form_link = LinkForm(request.POST)