Skip to content

Commit

Permalink
Add função detalhar tarefa #18
Browse files Browse the repository at this point in the history
  • Loading branch information
tacianosilva committed Nov 12, 2020
1 parent 651b0d6 commit 54a02f5
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tasktracking/tasks/templates/tasks/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@

{% for tarefa in lista_tarefas %}
<li class="task-item">
<span>{{tarefa}}</span>
<span><i class="fas fa-trash"></i></span>
<span><i class="fas fa-edit"></i></span>
<a href="{% url 'detalhar_tarefa' tarefa.pk %}"
<span>{{ tarefa }}</span>
</a>
<span>Lista de Tags (tarefa.tag_set.all)</span>
<span><i class="fas fa-trash"></i></span>
<span><i class="fas fa-edit"></i></span>
</li>
{% endfor %}
</ul>
Expand Down
54 changes: 54 additions & 0 deletions tasktracking/tasks/templates/tasks/tarefa/detalhar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{% extends "base.html" %}

{% block titulo %}
<title>PWeb 2020.6 - Detalhar Tarefa</title>
{% endblock %}

{% block content %}
<div class="content">
<table class="table table-striped table-sm table-bordered">
<tr>
<td class="font-weight-bold" width="20%">Identificador</td>
<td>{{ object.identificador }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Nome</td>
<td>{{ object.nome }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Descrição</td>
<td>{{ object.descrição }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Criação</td>
<td>{{ object.criada_em }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Fechamento</td>
<td>{{ object.fechada_em }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Status</td>
<td>{{ object.status }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Situação</td>
<td>{{ object.situacao }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Criador</td>
<td>{{ object.usuario }}</td>
</tr>
<tr>
<td class="font-weight-bold" width="20%">Links</td>
<td>
<ul>
{% for link in object.link_set.all %}
<li>{{ link }}</li>
{% endfor %}
</ul>
</td>
</tr>
</table>
</div>
{% endblock%}
1 change: 1 addition & 0 deletions tasktracking/tasks/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
urlpatterns = [
path('', views.index, name='index'),
path('cadastrar_tarefa', views.cadastrar_tarefa, name='cadastrar_tarefa'),
path('detalhar_tarefa/<int:pk>/', views.TarefaDetailView.as_view(), name='detalhar_tarefa'),
path('cadastrar_link', views.cadastrar_link, name='cadastrar_link'),
]
9 changes: 8 additions & 1 deletion tasktracking/tasks/views.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 54a02f5

Please sign in to comment.