Skip to content

Commit c178e64

Browse files
finalizando o crud #23
1 parent 48b69d3 commit c178e64

File tree

7 files changed

+22
-16
lines changed

7 files changed

+22
-16
lines changed

tasktracking/tasks/static/css/styles.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ a:hover {
2020

2121
/* Barra de Navegação */
2222

23+
.logout {
24+
/*margin-right: 15px;*/
25+
right: 20px;
26+
27+
}
28+
2329
.navbar {
2430
border-bottom: 2px solid#cc71cf;
2531
margin-bottom: 70px;

tasktracking/tasks/templates/base.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@
2929
<li><a class="nav-link" href="#">Execuções</a></li>
3030
<li><a class="nav-link" href="">
3131
{% if user.is_authenticated %}
32-
Hi {{ user.username }}!
33-
<p><a href="{% url 'logout' %}">Log Out</a></p>
32+
Oi {{ user.username }}!
33+
<li><a class="nav-link" href="{% url 'logout' %}">Logout</a></li>
3434
{% else %}
35-
<p>You are not logged in</p>
36-
<a href="{% url 'login' %}">Log In</a>
35+
<li><a class="nav-link" href="{% url 'login' %}">Login</a></li>
3736
{% endif %}
3837
</ul>
3938
</div>

tasktracking/tasks/templates/registration/login.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<body>
44
<h2>Log In</h2>
55
<form method="post">
6-
<input type="hidden" name="csrfmiddlewaretoken" value="oknvdDtxFgQqC1JNAiGL5kyxOuDIU1JKrdHto4Ih39hOzW48kh1O5gjJsf3smaZx">
6+
{% csrf_token %}
77
<ul class="errorlist nonfield">
88
<li>Por favor, entre com um usuário e senha corretos. Note que ambos os campos diferenciam maiúsculas e minúsculas.
99
</li>
@@ -17,6 +17,8 @@ <h2>Log In</h2>
1717
<input type="password" name="password" autocomplete="current-password" required="" id="id_password">
1818
</p>
1919
<button type="submit">Log In</button>
20+
2021
</form>
22+
<a href="{% url 'signup' %}">cadastre-se.</a>
2123
</body>
2224
</html>

tasktracking/tasks/templates/registration/signup.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
{% extends 'base.html' %}
2-
31
{% block title %}Sign Up{% endblock %}
42

53
{% block content %}

tasktracking/tasks/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django.views.generic.base import TemplateView
77

88

9-
#from .views import SignUpView
9+
from .views import SignUpView
1010

1111
urlpatterns = [
1212
path('', views.index, name='index'),
@@ -18,6 +18,6 @@
1818
path('cadastrar_execucao', views.cadastrar_execucao, name='cadastrar_execucao'),
1919
path('accounts/', include('django.contrib.auth.urls')), # new
2020
#path('accounts/', include('accounts.urls')), # new
21-
#path('signup/', SignUpView.as_view(), name='signup'),
21+
path('signup/', SignUpView.as_view(), name='signup'),
2222
#path('', TemplateView.as_view(template_name='home.html'), name='home'), # new
2323
]

tasktracking/tasks/views.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from datetime import datetime
66
from tasks.forms import LinkForm, TarefaForm, TagForm
77
from django.core.paginator import Paginator
8-
#from django.contrib.auth.forms import UserCreationForm
9-
#from django.urls import reverse_lazy
10-
#from django.views import generic
8+
from django.contrib.auth.forms import UserCreationForm
9+
from django.urls import reverse_lazy
10+
from django.views import generic
1111

1212
from tasks.models import Execucao, Tarefa
1313
from tasks.models import Link
@@ -116,7 +116,7 @@ def stop_execucao(request):
116116
data = dict()
117117
return JsonResponse(data)
118118

119-
#class SignUpView(generic.CreateView):
120-
# form_class = UserCreationForm
121-
# success_url = reverse_lazy('login')
122-
# template_name = 'registration/signup.html'
119+
class SignUpView(generic.CreateView):
120+
form_class = UserCreationForm
121+
success_url = reverse_lazy('login')
122+
template_name = 'registration/signup.html'

tasktracking/tasktracking/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
ALLOWED_HOSTS = []
2929

3030
LOGIN_REDIRECT_URL = '/'
31+
LOGOUT_REDIRECT_URL = '/' # new
3132
# Application definition
3233

3334
INSTALLED_APPS = [

0 commit comments

Comments
 (0)