From 4acf181777605c225c577dfafff12abdd24ade1d Mon Sep 17 00:00:00 2001 From: sa23587 <saif.ali2@stud.th-deg.de> Date: Sun, 9 Jun 2019 14:18:37 +0200 Subject: [PATCH] Login and SignUp --- accounts/apps.py | 2 +- accounts/models.py | 2 +- accounts/tests.py | 2 +- accounts/urls.py | 2 +- accounts/views.py | 4 ++++ 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/accounts/apps.py b/accounts/apps.py index 85c631f..dc467d8 100644 --- a/accounts/apps.py +++ b/accounts/apps.py @@ -3,4 +3,4 @@ from django.apps import AppConfig class AccountsConfig(AppConfig): name = 'accounts' -#inorder to start an app \ No newline at end of file +#inorder to start an app. \ No newline at end of file diff --git a/accounts/models.py b/accounts/models.py index deeb5c9..571052d 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,4 +1,4 @@ from django.db import models # Create your models here. -#databases models +#databases models. diff --git a/accounts/tests.py b/accounts/tests.py index f56bc78..05a316a 100644 --- a/accounts/tests.py +++ b/accounts/tests.py @@ -1,3 +1,3 @@ from django.test import TestCase -# Create your tests here. for security +# Create your tests here. for security. diff --git a/accounts/urls.py b/accounts/urls.py index 181dfa3..7ab2543 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -8,4 +8,4 @@ urlpatterns = [ url(r'^login/$', views.login_view, name="login"), url(r'^logout/$', views.logout_view, name="logout"), ] -#created by Saif Ali \ No newline at end of file +#created by Saif Ali. \ No newline at end of file diff --git a/accounts/views.py b/accounts/views.py index 3a6e9eb..c92c129 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -29,3 +29,7 @@ def login_view(request): form = AuthenticationForm() return render(request, 'accounts/login.html', { 'form': form }) +def logout_view(request): + if request.method == 'POST': + logout(request) + return redirect('articles:list') \ No newline at end of file -- GitLab