From 8ba1cce441307026890e80a6620eee2f9593c0ed Mon Sep 17 00:00:00 2001 From: Wanessa Bezerra Date: Wed, 11 Nov 2020 20:09:58 -0300 Subject: [PATCH 1/7] =?UTF-8?q?Cria=C3=A7=C3=A3o=20da=20pasta=20link=20e?= =?UTF-8?q?=20do=20arquivo=20cadastrar=5Flink.html=20#20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasktracking/tasks/templates/base.html | 8 ++--- .../templates/tasks/link/cadastrar_link.html | 35 +++++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 tasktracking/tasks/templates/tasks/link/cadastrar_link.html diff --git a/tasktracking/tasks/templates/base.html b/tasktracking/tasks/templates/base.html index 07bb395..87b500d 100644 --- a/tasktracking/tasks/templates/base.html +++ b/tasktracking/tasks/templates/base.html @@ -17,7 +17,7 @@ - + - \ No newline at end of file + diff --git a/tasktracking/tasks/templates/tasks/link/cadastrar_link.html b/tasktracking/tasks/templates/tasks/link/cadastrar_link.html new file mode 100644 index 0000000..1a24896 --- /dev/null +++ b/tasktracking/tasks/templates/tasks/link/cadastrar_link.html @@ -0,0 +1,35 @@ +{% extends "base.html" %} + +{% block titulo %} + PWeb 2020.6 - Adicionar Link +{% endblock %} + +{% block content %} +
+
+ {% csrf_token %} + + + {% for field in form_tarefa.visible_fields %} + + + + + {% endfor %} +
+ + {{ field }} + {% if field.help_text %} + {{ field.help_text }} + {% endif %} + {% for error in field.errors %} +

{{ error }}

+ {% endfor %} +
+ +
+ +
+
+
+{% endblock %} From c4903e6592b6b3b46b7e463bdf3f6dc7591d5d24 Mon Sep 17 00:00:00 2001 From: Wanessa Bezerra Date: Wed, 11 Nov 2020 20:25:10 -0300 Subject: [PATCH 2/7] =?UTF-8?q?Altera=C3=A7=C3=A3o=20no=20styles.css=20-?= =?UTF-8?q?=20rodap=C3=A9=20#20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasktracking/tasks/static/css/styles.css | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tasktracking/tasks/static/css/styles.css b/tasktracking/tasks/static/css/styles.css index 5653f79..edc3b16 100644 --- a/tasktracking/tasks/static/css/styles.css +++ b/tasktracking/tasks/static/css/styles.css @@ -2,9 +2,10 @@ padding: 0; } + /* Barra de Navegação */ -.navbar { +.navbar { border-bottom: 1px solid #333; margin-bottom: 20px; } @@ -22,6 +23,7 @@ letter-spacing: 1px; } + /* Botão de adicionar */ .add-div { @@ -40,6 +42,7 @@ margin-left: 5px; } + /* Busca */ .fas.fa-search { @@ -55,6 +58,7 @@ display: inline-block; } + /* Lista de tarefas */ .list-div { @@ -82,15 +86,18 @@ } .fas.fa-edit { - color: #808080 ; + color: #808080; cursor: pointer; margin: 5px; font-size: 20px; float: right; } + /* Rodapé */ -footer { + +footer#rodape { + clear: both; background-color: #333; position: absolute; bottom: 0; @@ -99,9 +106,9 @@ footer { border-top: 2px solid #202020; } -footer p { - color: #f5f5f5; +footer#rodape p { text-align: center; + color: #f5f5f5; top: 40%; position: relative; -} +} \ No newline at end of file From 8257447e1eda9995a9a0566ae790acd4dbf85c4f Mon Sep 17 00:00:00 2001 From: Wanessa Bezerra Date: Wed, 11 Nov 2020 21:02:09 -0300 Subject: [PATCH 3/7] =?UTF-8?q?Altera=C3=A7=C3=A3o=20no=20menu=20da=20p?= =?UTF-8?q?=C3=A1gina=20#20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasktracking/tasks/templates/base.html | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tasktracking/tasks/templates/base.html b/tasktracking/tasks/templates/base.html index 87b500d..8cbdecc 100644 --- a/tasktracking/tasks/templates/base.html +++ b/tasktracking/tasks/templates/base.html @@ -19,14 +19,12 @@ From 688f8da7a434e4d4f36acf750a63e57d13fc8030 Mon Sep 17 00:00:00 2001 From: Wanessa Bezerra Date: Thu, 12 Nov 2020 08:24:03 -0300 Subject: [PATCH 4/7] =?UTF-8?q?Atualiza=C3=A7=C3=A3o=20do=20arquivo=20urls?= =?UTF-8?q?=20e=20views=20#20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasktracking/tasks/models.py | 1 - tasktracking/tasks/templates/base.html | 2 +- tasktracking/tasks/urls.py | 3 ++- tasktracking/tasks/views.py | 17 +++++++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tasktracking/tasks/models.py b/tasktracking/tasks/models.py index e9bb52d..b2bae1d 100644 --- a/tasktracking/tasks/models.py +++ b/tasktracking/tasks/models.py @@ -61,7 +61,6 @@ class Tarefa(models.Model): fechada_em = models.DateTimeField(null=True, blank=True) status = models.CharField(max_length=1, choices=STATUS_CHOICES) situacao = models.CharField(max_length=1, choices=SITUACAO_CHOICES) - usuario = models.ForeignKey(Usuario, on_delete=models.PROTECT) def __str__(self): diff --git a/tasktracking/tasks/templates/base.html b/tasktracking/tasks/templates/base.html index 8cbdecc..fa7b445 100644 --- a/tasktracking/tasks/templates/base.html +++ b/tasktracking/tasks/templates/base.html @@ -23,7 +23,7 @@
  • Tarefas
  • Tags
  • Links
  • -
  • Usuario
  • +
  • Usuário
  • Execuções
  • diff --git a/tasktracking/tasks/urls.py b/tasktracking/tasks/urls.py index 7e30864..0dfaecb 100644 --- a/tasktracking/tasks/urls.py +++ b/tasktracking/tasks/urls.py @@ -5,4 +5,5 @@ urlpatterns = [ path('', views.index, name='index'), path('cadastrar_tarefa', views.cadastrar_tarefa, name='cadastrar_tarefa'), -] \ No newline at end of file + path('cadastrar_link', views.cadastrar_link, name='cadastrar_link'), +] diff --git a/tasktracking/tasks/views.py b/tasktracking/tasks/views.py index 996eb81..fbd6537 100644 --- a/tasktracking/tasks/views.py +++ b/tasktracking/tasks/views.py @@ -3,11 +3,13 @@ from tasks.forms import TarefaForm from tasks.models import Tarefa +from tasks.models import Link def index(request): """View function for home page of site.""" lista_tarefas = Tarefa.objects.all() + lista_link = Link.objects.all() context = { 'lista_tarefas': lista_tarefas @@ -29,3 +31,18 @@ def cadastrar_tarefa(request): 'form_tarefa': form_tarefa } return render(request, 'tasks/tarefa/cadastrar_tarefa.html', context=context) + +def cadastrar_link(request): + if request.method == 'POST': + form_link = LinkForm(request.POST) + if form_link.is_valid(): + form_link.save() + return redirect('index') + else: + form_link = LinkForm() + + context = { + 'form_link': form_link + } + return render(request, 'tasks/link/cadastrar_link.html', context=context) + From 651b0d67ca798e9fc0ace9a7d77e38ec7029d11a Mon Sep 17 00:00:00 2001 From: Taciano Morais Silva Date: Thu, 12 Nov 2020 09:19:20 -0300 Subject: [PATCH 5/7] Add foreign key em link para tarefa #20 --- .../tasks/migrations/0004_link_tarefa.py | 19 +++++++++++++++++++ tasktracking/tasks/models.py | 8 ++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 tasktracking/tasks/migrations/0004_link_tarefa.py diff --git a/tasktracking/tasks/migrations/0004_link_tarefa.py b/tasktracking/tasks/migrations/0004_link_tarefa.py new file mode 100644 index 0000000..6ef0222 --- /dev/null +++ b/tasktracking/tasks/migrations/0004_link_tarefa.py @@ -0,0 +1,19 @@ +# Generated by Django 3.1.2 on 2020-11-12 11:47 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('tasks', '0003_auto_20201105_0835'), + ] + + operations = [ + migrations.AddField( + model_name='link', + name='tarefa', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='tasks.tarefa'), + ), + ] diff --git a/tasktracking/tasks/models.py b/tasktracking/tasks/models.py index b2bae1d..cf67ffc 100644 --- a/tasktracking/tasks/models.py +++ b/tasktracking/tasks/models.py @@ -15,6 +15,9 @@ class Usuario(models.Model): null=True ) + def __str__(self): + return self.nome + class Tag(models.Model): """ Jonas @@ -31,9 +34,10 @@ class Link(models.Model): """ nome = models.CharField(max_length=50) url = models.URLField() + tarefa = models.ForeignKey('Tarefa', on_delete=models.CASCADE, null=True) + def __str__(self): - self.nome - self.url + return self.nome + ' ' + self.url class Tarefa(models.Model): From 54a02f5f02a99f03514ef2364e5cc25c0e34d80b Mon Sep 17 00:00:00 2001 From: Taciano Morais Silva Date: Thu, 12 Nov 2020 09:20:57 -0300 Subject: [PATCH 6/7] =?UTF-8?q?Add=20fun=C3=A7=C3=A3o=20detalhar=20tarefa?= =?UTF-8?q?=20#18?= 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) From a53a71962c1f0c8119510c2aad025c6cc9c3b087 Mon Sep 17 00:00:00 2001 From: Taciano Morais Silva Date: Thu, 12 Nov 2020 09:21:31 -0300 Subject: [PATCH 7/7] =?UTF-8?q?Corre=C3=A7=C3=B5es=20no=20Cadastrar=20Link?= =?UTF-8?q?=20#20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tasktracking/tasks/forms.py | 9 +++++++-- tasktracking/tasks/templates/base.html | 4 +++- .../tasks/templates/tasks/link/cadastrar_link.html | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tasktracking/tasks/forms.py b/tasktracking/tasks/forms.py index 62b3fe0..57427f7 100644 --- a/tasktracking/tasks/forms.py +++ b/tasktracking/tasks/forms.py @@ -1,8 +1,13 @@ from django import forms -from tasks.models import Tarefa +from tasks.models import Link, Tarefa class TarefaForm(forms.ModelForm): class Meta: model = Tarefa - fields = '__all__' \ No newline at end of file + fields = '__all__' + +class LinkForm(forms.ModelForm): + class Meta: + model = Link + fields = '__all__' diff --git a/tasktracking/tasks/templates/base.html b/tasktracking/tasks/templates/base.html index fa7b445..fc76fec 100644 --- a/tasktracking/tasks/templates/base.html +++ b/tasktracking/tasks/templates/base.html @@ -22,14 +22,16 @@ + {% block content %} {% endblock %} +

    Copyright © 2020 - by Turma de Pweb 2020.6

    diff --git a/tasktracking/tasks/templates/tasks/link/cadastrar_link.html b/tasktracking/tasks/templates/tasks/link/cadastrar_link.html index 1a24896..64c60f8 100644 --- a/tasktracking/tasks/templates/tasks/link/cadastrar_link.html +++ b/tasktracking/tasks/templates/tasks/link/cadastrar_link.html @@ -10,7 +10,7 @@ {% csrf_token %} - {% for field in form_tarefa.visible_fields %} + {% for field in form_link.visible_fields %}