From 099c2e902a4d53f11732902ead03eb0237d9343e Mon Sep 17 00:00:00 2001 From: haider000 Date: Fri, 16 Aug 2019 00:42:57 +0530 Subject: [PATCH 01/10] added extra field in signup form and some styling to form --- Argon/settings.py | 5 +++- Argon/urls.py | 14 +++++++--- Argon/wsgi.py | 2 ++ accounts/forms.py | 13 ++++++++++ accounts/urls.py | 6 +++-- accounts/views.py | 41 +++++++++++++++++++++++++----- db.sqlite3 | Bin 131072 -> 131072 bytes home/urls.py | 6 ++++- home/views.py | 2 +- requirements.txt | 1 - templates/base.html | 27 ++++++++++++++------ templates/home.html | 3 +-- templates/registration/login.html | 31 +++++++++++++++------- templates/signup.html | 41 ++++++++++++++---------------- 14 files changed, 134 insertions(+), 58 deletions(-) create mode 100644 accounts/forms.py diff --git a/Argon/settings.py b/Argon/settings.py index 2d59599..250463e 100644 --- a/Argon/settings.py +++ b/Argon/settings.py @@ -33,6 +33,7 @@ INSTALLED_APPS = [ 'home.apps.HomeConfig', 'accounts.apps.AccountsConfig', + 'crispy_forms', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', @@ -122,4 +123,6 @@ STATIC_URL = '/static/' LOGIN_REDIRECT_URL = 'home' -LOGOUT_REDIRECT_URL = 'home' \ No newline at end of file +LOGOUT_REDIRECT_URL = 'home' + +CRISPY_TEMPLATE_PACK = 'bootstrap4' \ No newline at end of file diff --git a/Argon/urls.py b/Argon/urls.py index 79a45fe..0d31fc2 100644 --- a/Argon/urls.py +++ b/Argon/urls.py @@ -14,11 +14,17 @@ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path, include - +from django.urls import path +from django.urls import include +from django.contrib.auth import views as auth_views urlpatterns = [ path('admin/', admin.site.urls), - path('accounts/', include('django.contrib.auth.urls')), path('accounts/', include('accounts.urls')), path('', include('home.urls')), -] + path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'), + + + + + ] + diff --git a/Argon/wsgi.py b/Argon/wsgi.py index c574e74..e8e5dbe 100644 --- a/Argon/wsgi.py +++ b/Argon/wsgi.py @@ -14,3 +14,5 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Argon.settings") application = get_wsgi_application() + + diff --git a/accounts/forms.py b/accounts/forms.py new file mode 100644 index 0000000..c8cf6cd --- /dev/null +++ b/accounts/forms.py @@ -0,0 +1,13 @@ +from django import forms +from django.contrib.auth.models import User +from django.contrib.auth.forms import UserCreationForm + + +class SignUpForm(UserCreationForm): + first_name = forms.CharField(max_length=30, required=False, ) + last_name = forms.CharField(max_length=30, required=False, ) + email = forms.EmailField(max_length=50, required=True, ) + + class Meta: + model = User + fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',) diff --git a/accounts/urls.py b/accounts/urls.py index 3cd99a8..479fa7f 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -1,7 +1,9 @@ from django.urls import path +from accounts.views import SignUpView -from .views import SignUpView urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), - ] \ No newline at end of file + +] + diff --git a/accounts/views.py b/accounts/views.py index 1068239..ec4fb15 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,11 +1,38 @@ -from django.contrib.auth.forms import UserCreationForm - +from django.http import HttpResponseRedirect +from django.shortcuts import render, redirect +from django.views.generic.edit import FormView +from .forms import SignUpForm +from django.contrib.auth import authenticate, login +from django.views.generic import TemplateView from django.urls import reverse_lazy +from django.contrib import messages + +class SignUpView(FormView): + form_class = SignUpForm + template_name = 'signup.html' -from django.views import generic + def get(self, request, *args, **kwargs): + form = self.form_class(None) + return render(request, self.template_name, {'form': form}) + def post(self, request, *args, **kwargs): + form = self.form_class(request.POST) + if form.is_valid(): + form.save(commit=False) + # + username = form.cleaned_data['username'] + raw_password = form.cleaned_data['password1'] + form.save() + + user = authenticate(username=username, password=raw_password) + user.set_password(raw_password) + user.save() + messages.success(request,f'Account created for {username}') + if user is not None: + + if user.is_active: + login(request, user) + return redirect('home') + + return render(request, self.template_name, {'form': form}) -class SignUpView(generic.CreateView): - form_class = UserCreationForm - success_url = reverse_lazy('login') - template_name = 'signup.html' diff --git a/db.sqlite3 b/db.sqlite3 index 5f72dbde0ac2b9cb702ab048fd776c84f1339ef0..ac5546582ab2b1bbbeae8907c5e31c0ff8be525f 100644 GIT binary patch delta 4520 zcmb7{ON=8&8OQDM>||!MGrgP5>}Xjg>m}Yp;;g5utDg=l;&J;qevIFb1BvZ^x7%-b z+kNpm$~~aDMsNun$N`~|2scC`!4)YSK+1t2Bt$MjQBV%yK(##&GMQPxw%XNpebvAE z*H_>7)srXdPoAv*;GX;4AAURRe)kt|{Ph0X8!qhc*c-<;yhZHJ^B&J5x1cpTa`*Ly zV5ptf+g;gnWbXM^usZ|etdmp^DWob2b*sl zKk!aAzyIc|E7#I*T?-*&Mm6NANir?D*(5b`+y&#wutSs6{?O2BL=LYPb9ROg+3DiG zku64*TCrwlh>Tt@hG0#LkTtDlr->R-vy(=a*R70p zNvUQ;wFXfh*TV@qVdVR@3e{;&DXmFRc*|(3DI*Gmm^?n~7f+9i6;7{LCgEBoGpJW6 zJ)v4^m2mngl2FaGTWzjet7f_ht*d5>ExXQ_V7hqN*6T3@rnU7nU&3p4TgepDR@#<9 zx)Px>cFxKe=xwL*Y$3@JIN%=P>?4Bn0yYSlAcY4Y4H$}k^Hujks-r*8yvLt*zU5wD z!QOXa?_(by-|D@GJ@k3f?*As^%JIjuhc_Q>e&M>kGIwF>=4)HO-TKar`Ln;i{?&DU z`bKEC*VF}xczvie z2#WRr+!!OF|&i}Z95(gBJEfMibSMNu-W!9bHc1M5m|WJU%!h66Zl4J6GPDDoUWzvSMT z?E(b8bE)d((SCR`(UeJEj`{3xq0B}q{IpkW#O3C}!Khdck8LX2j_bNXA09@h@{mo8 zU@df!n+)P~fWZMlvJN*ZY7)|0mmCRaUDXn=L`RlX0H+w7fuf{!r1{IYPq=S8df&bj z+iVQgVw432V0j-d;{A%>PAG{?!7M0#5e)GNOLvF*sLYf}W>)RAb5XGzttG5;Zqf@N zf(`;IK;jHwk=~X#FufCDXiCCmE^=l812jc(3}Jd(^H-lcq1}!l+Pjz0&U{UiWAWsO zi`JpxD<<*=to6J3zG*g-C0QKpTZ(W9g)yKiwPHF{CY7$B_V=r$uh9}gNCg2NU`Y}O zq@yxSXXCulRfIq@pfprL9H5QFu=EA3XDB291iu&n=K?s56C@rFCHP2w{_?F8{+*Yu zR$H8oi3*rjhWeo|mFLUU&@cOwopwBD&}u5mMWu8n6~{+a$eZTgexv~R z44n3ryvPO*kTgv&q}I`_`5w0EnmM6wcgKGvvDS^zbTyhR?WY?)n_#6w3N!|>UVp%| zheka%h)Hd^%EL%n8remSfRoZe62wpSMe;%~z@2~(m;go46v;I@x;laoI^VO=;_edW zGc!5>35Fm+S5q4ESGG=F;%a1_RY)UN2^-_C?i2T>i98AXN&$$61)Qe(O69QQ_s6(B zjjxh3v3wBCn)ztIt>w-|UOt=-k{ogg547QEc%lK1W|g(UuF zc9}WpWnW<0B3YVLqf^RP@=x-iqCHk3LNl+nsSrC#?+dLgmE=dU#Iz_wsjg^5b`o!$ z^8zm*gOEd?z+!y~qcIZ2j;0JHr6K6HCP*z?Ynt{&aL518j1f7c2^trqu{9PIX-?cY zp}*&ZyGsLzFH@(elwwkoUNq&4BvN^!(kUw$vmzyvT)CPVjRm__DCl-bN;Y#^q#~(O zbOKJI-D3YQ0jMBFp!~)Fk}M$TuBGX+BB0tu)?`V!2!6(m%s_x*IAo|RQ)xV%lg}=x zcb`I?tj9x95lm-IRZjZUzEaN@ti7DTC}uOw^vz~_OsF}&P%?)(GoHjQ7DHfGQx)05yhbbh|?A-L(xW9=Fh8^!5ILc zDusg-Z8XM%X=4tqIsC5mhY!+M@`uKUu^cnoXR|4@>nml)^{6nIj%1#;bb`&;N1VO$w;dTu)T{ zJ*5&>8k62$FJ7vpdWmM~zz7ZMbobnEmuDID3^D*w++*R6kAPG^#8x=jX-E)^*Qa_c9r7I?ZKfx#4s+ zS|{=P*)7il_i6Z$r0dR~r?(r?x_=a~h_$wpo~{_^LW z|G4hKK67DTVgJNFJHGYg6YTyqkK4WKSzK3EJ?@Rw>u4Ac_PGoD7gFzY)akF-3#*|ulG*QNxQE6ksGI_Q#2L6})S2pt~gz!&XAU3&7UxkT*Ve%Y(IW}f- zR%T#Q?>J>J>%9CQ` zVC28U07UGY1sg8#Z@yEnD!|LYz`)E`z`&o$_lB=b^|IU?;EDTEXa&ZeR z^LI*$RMGc#3#~{F^UNyE3ODvKb2rd8N%D$x0=lBqB|IXqEGH+i!c^Zoz{J4OHX|`J z1;ZL+D^pWFQ%fUb3(Luw^W`H=4S+zUthCC}$0;$n)Tb~CAMh24~&Q}139{(c- z{_p&c_}>6S^$NczC$l&s*#FF2%#w@{H!^MhzMl8PW|jwkf%xxlEv#t1Uz5m4|3znm - + {% load staticfiles %} + + + + Argon +

Argon

-
- {% block content %} - - {% endblock content %} -
- - \ No newline at end of file + {% if messages %} + {% for message in messages %} +
+ {{message}} +
+ {% endfor %} + + {% endif %} +
+ {% block content %} + {% endblock content %} +
+ \ No newline at end of file diff --git a/templates/home.html b/templates/home.html index 7c958ae..a7a18c3 100644 --- a/templates/home.html +++ b/templates/home.html @@ -2,9 +2,8 @@ {% block content %} -

This is HomePage.

+

This is HomePage

Login

SignUp

{% endblock content %} - diff --git a/templates/registration/login.html b/templates/registration/login.html index 4106d71..c584125 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -1,12 +1,25 @@ {% extends 'base.html' %} - +{% load crispy_forms_tags %} {% block content %} - -

Log In

-
- {% csrf_token %} - {{ form.as_p }} - -
- +
+
+
+ +
+
+ +
+ +
+ {% csrf_token %} +

Log In

+ {{ form|crispy }} + +
+
+
+
+
+
+
{% endblock content %} \ No newline at end of file diff --git a/templates/signup.html b/templates/signup.html index 9982a8b..f0f6f19 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -1,26 +1,23 @@ - {% extends 'base.html' %} - +{% load crispy_forms_tags %} {% block content %} - - - -

Sign up

- -
- {% csrf_token %} - {{ form.as_p }} - -

- -

- -

- - -

-
- - +
+
+ +
+
+ +
+
+ {% csrf_token %} +

Sign up

+ {{ form|crispy }} +

+
+
+
+
+
+
{% endblock content %} \ No newline at end of file From 409813e6659ab9f04869da01f9dc0736d9c8b2fe Mon Sep 17 00:00:00 2001 From: haider000 Date: Fri, 16 Aug 2019 14:16:56 +0530 Subject: [PATCH 02/10] done the required changes --- .travis.yml | 14 ++++++++++++++ Argon/settings.py | 3 --- Argon/urls.py | 4 ---- Argon/wsgi.py | 4 ---- accounts/admin.py | 1 - accounts/apps.py | 1 - accounts/forms.py | 1 - accounts/models.py | 1 - accounts/tests.py | 1 - accounts/urls.py | 4 +--- accounts/views.py | 16 +++++++--------- home/admin.py | 1 - home/apps.py | 1 - home/models.py | 1 - home/tests.py | 1 - home/urls.py | 2 -- home/views.py | 1 - templates/base.html | 13 ++++++------- templates/home.html | 11 ++++------- templates/registration/login.html | 3 --- templates/signup.html | 1 - 21 files changed, 32 insertions(+), 53 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b011827 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python # => 1 + python: # => 2 + - "3.6" + - "3.7" + services: # => 3 + - mysql + env: # => 4 + -DJANGO=2.0.1 DB=mysql + install: # => 5 + - pip install -r requirements.txt + before_script: # => 6 + - mysql -e 'create database test;' -u root + script: # => 7 + - python manage.py test \ No newline at end of file diff --git a/Argon/settings.py b/Argon/settings.py index 250463e..02147e2 100644 --- a/Argon/settings.py +++ b/Argon/settings.py @@ -119,10 +119,7 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/ - STATIC_URL = '/static/' - LOGIN_REDIRECT_URL = 'home' LOGOUT_REDIRECT_URL = 'home' - CRISPY_TEMPLATE_PACK = 'bootstrap4' \ No newline at end of file diff --git a/Argon/urls.py b/Argon/urls.py index 0d31fc2..600cfeb 100644 --- a/Argon/urls.py +++ b/Argon/urls.py @@ -22,9 +22,5 @@ path('accounts/', include('accounts.urls')), path('', include('home.urls')), path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'), - - - - ] diff --git a/Argon/wsgi.py b/Argon/wsgi.py index e8e5dbe..e6304a1 100644 --- a/Argon/wsgi.py +++ b/Argon/wsgi.py @@ -6,13 +6,9 @@ For more information on this file, see https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ """ - import os - from django.core.wsgi import get_wsgi_application - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Argon.settings") - application = get_wsgi_application() diff --git a/accounts/admin.py b/accounts/admin.py index 8c38f3f..4f57ae9 100644 --- a/accounts/admin.py +++ b/accounts/admin.py @@ -1,3 +1,2 @@ from django.contrib import admin - # Register your models here. diff --git a/accounts/apps.py b/accounts/apps.py index 9b3fc5a..80d5b5f 100644 --- a/accounts/apps.py +++ b/accounts/apps.py @@ -1,5 +1,4 @@ from django.apps import AppConfig - class AccountsConfig(AppConfig): name = 'accounts' diff --git a/accounts/forms.py b/accounts/forms.py index c8cf6cd..7e3e62c 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -2,7 +2,6 @@ from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm - class SignUpForm(UserCreationForm): first_name = forms.CharField(max_length=30, required=False, ) last_name = forms.CharField(max_length=30, required=False, ) diff --git a/accounts/models.py b/accounts/models.py index 71a8362..ca200a0 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -1,3 +1,2 @@ from django.db import models - # Create your models here. diff --git a/accounts/tests.py b/accounts/tests.py index 7ce503c..9331e78 100644 --- a/accounts/tests.py +++ b/accounts/tests.py @@ -1,3 +1,2 @@ from django.test import TestCase - # Create your tests here. diff --git a/accounts/urls.py b/accounts/urls.py index 479fa7f..9c7f243 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -1,9 +1,7 @@ from django.urls import path from accounts.views import SignUpView - urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), - -] + ] diff --git a/accounts/views.py b/accounts/views.py index ec4fb15..f7737d3 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -22,17 +22,15 @@ def post(self, request, *args, **kwargs): # username = form.cleaned_data['username'] raw_password = form.cleaned_data['password1'] - form.save() - - user = authenticate(username=username, password=raw_password) - user.set_password(raw_password) - user.save() - messages.success(request,f'Account created for {username}') + form.save()#saves the form data + user = authenticate(username=username, password=raw_password)#authenticates the user info + user.set_password(raw_password)#will set the password + user.save()#save the user in the user table + messages.success(request,f'Account created for {username}')#this will show an alert if the account is created succesfully if user is not None: - - if user.is_active: + if user.is_active: login(request, user) return redirect('home') - + return render(request, self.template_name, {'form': form}) diff --git a/home/admin.py b/home/admin.py index 8c38f3f..4f57ae9 100644 --- a/home/admin.py +++ b/home/admin.py @@ -1,3 +1,2 @@ from django.contrib import admin - # Register your models here. diff --git a/home/apps.py b/home/apps.py index 90dc713..b7e5fdd 100644 --- a/home/apps.py +++ b/home/apps.py @@ -1,5 +1,4 @@ from django.apps import AppConfig - class HomeConfig(AppConfig): name = 'home' diff --git a/home/models.py b/home/models.py index 71a8362..ca200a0 100644 --- a/home/models.py +++ b/home/models.py @@ -1,3 +1,2 @@ from django.db import models - # Create your models here. diff --git a/home/tests.py b/home/tests.py index 7ce503c..9331e78 100644 --- a/home/tests.py +++ b/home/tests.py @@ -1,3 +1,2 @@ from django.test import TestCase - # Create your tests here. diff --git a/home/urls.py b/home/urls.py index 4538a8d..66d85ee 100644 --- a/home/urls.py +++ b/home/urls.py @@ -1,8 +1,6 @@ from django.urls import path - from .views import HomePageView - urlpatterns = [ path('', HomePageView.as_view(), name='home'), ] diff --git a/home/views.py b/home/views.py index 72569da..d2ce257 100644 --- a/home/views.py +++ b/home/views.py @@ -1,5 +1,4 @@ from django.views.generic import TemplateView - class HomePageView(TemplateView): template_name = 'home.html' diff --git a/templates/base.html b/templates/base.html index 337f213..94c16a7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,22 +6,21 @@ Argon -

Argon

+ {% if messages %} {% for message in messages %}
{{message}}
{% endfor %} - {% endif %} -
- {% block content %} - {% endblock content %} -
- \ No newline at end of file +
+ {% block content %} + {% endblock content %} +
+ \ No newline at end of file diff --git a/templates/home.html b/templates/home.html index a7a18c3..dc2ca3a 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,9 +1,6 @@ {% extends 'base.html' %} - {% block content %} - -

This is HomePage

- -

Login

-

SignUp

-{% endblock content %} +

This is HomePage

+

Login

+

SignUp

+{% endblock content %} \ No newline at end of file diff --git a/templates/registration/login.html b/templates/registration/login.html index c584125..80ff92f 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -4,12 +4,9 @@
-
-
-
{% csrf_token %}

Log In

diff --git a/templates/signup.html b/templates/signup.html index f0f6f19..58cb099 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -1,7 +1,6 @@ {% extends 'base.html' %} {% load crispy_forms_tags %} {% block content %} -
From 5e6b6a8d320623e858f696b9a920e24588b04555 Mon Sep 17 00:00:00 2001 From: haider000 Date: Fri, 16 Aug 2019 14:54:05 +0530 Subject: [PATCH 03/10] remove the spaces --- .travis.yml | 3 ++- Argon/settings.py | 13 ------------- Argon/urls.py | 1 - Argon/wsgi.py | 2 -- README.md | 2 +- accounts/urls.py | 1 - accounts/views.py | 1 - home/urls.py | 4 ---- templates/base.html | 2 +- templates/home.html | 2 +- templates/registration/login.html | 2 +- templates/signup.html | 2 +- 12 files changed, 7 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index b011827..f874641 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,5 @@ language: python # => 1 before_script: # => 6 - mysql -e 'create database test;' -u root script: # => 7 - - python manage.py test \ No newline at end of file + - python manage.py test + \ No newline at end of file diff --git a/Argon/settings.py b/Argon/settings.py index 02147e2..74fe4e9 100644 --- a/Argon/settings.py +++ b/Argon/settings.py @@ -11,11 +11,8 @@ """ import os - # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - - # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ @@ -27,7 +24,6 @@ ALLOWED_HOSTS = [] - # Application definition INSTALLED_APPS = [ @@ -101,22 +97,13 @@ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] - - # Internationalization # https://docs.djangoproject.com/en/2.0/topics/i18n/ - LANGUAGE_CODE = 'en-us' - TIME_ZONE = 'UTC' - USE_I18N = True - USE_L10N = True - USE_TZ = True - - # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/ STATIC_URL = '/static/' diff --git a/Argon/urls.py b/Argon/urls.py index 600cfeb..8c61581 100644 --- a/Argon/urls.py +++ b/Argon/urls.py @@ -23,4 +23,3 @@ path('', include('home.urls')), path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'), ] - diff --git a/Argon/wsgi.py b/Argon/wsgi.py index e6304a1..ba1e5e9 100644 --- a/Argon/wsgi.py +++ b/Argon/wsgi.py @@ -10,5 +10,3 @@ from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Argon.settings") application = get_wsgi_application() - - diff --git a/README.md b/README.md index 9d583c8..b3f09a7 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# Argon \ No newline at end of file +# Argon diff --git a/accounts/urls.py b/accounts/urls.py index 9c7f243..5c4b8b2 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -4,4 +4,3 @@ urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), ] - diff --git a/accounts/views.py b/accounts/views.py index f7737d3..57d5c10 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -33,4 +33,3 @@ def post(self, request, *args, **kwargs): return redirect('home') return render(request, self.template_name, {'form': form}) - diff --git a/home/urls.py b/home/urls.py index 66d85ee..895f413 100644 --- a/home/urls.py +++ b/home/urls.py @@ -4,7 +4,3 @@ urlpatterns = [ path('', HomePageView.as_view(), name='home'), ] - - - - diff --git a/templates/base.html b/templates/base.html index 94c16a7..f5973ff 100644 --- a/templates/base.html +++ b/templates/base.html @@ -23,4 +23,4 @@

Argon

{% block content %} {% endblock content %}
- \ No newline at end of file + diff --git a/templates/home.html b/templates/home.html index dc2ca3a..c86dde2 100644 --- a/templates/home.html +++ b/templates/home.html @@ -3,4 +3,4 @@

This is HomePage

Login

SignUp

-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/templates/registration/login.html b/templates/registration/login.html index 80ff92f..1548252 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -19,4 +19,4 @@

Log In

-{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/templates/signup.html b/templates/signup.html index 58cb099..cf74820 100644 --- a/templates/signup.html +++ b/templates/signup.html @@ -19,4 +19,4 @@

Sign up

-{% endblock content %} \ No newline at end of file +{% endblock content %} From 57e81d0f7ffc78283f48141ac8d05c3d7d4ab200 Mon Sep 17 00:00:00 2001 From: haider000 Date: Fri, 16 Aug 2019 15:27:35 +0530 Subject: [PATCH 04/10] removed spaces and errors --- Argon/settings.py | 20 ++------------------ accounts/apps.py | 1 - accounts/forms.py | 4 +--- accounts/urls.py | 1 - accounts/views.py | 4 ---- home/apps.py | 1 - home/urls.py | 1 - home/views.py | 1 - 8 files changed, 3 insertions(+), 30 deletions(-) diff --git a/Argon/settings.py b/Argon/settings.py index 74fe4e9..32c5100 100644 --- a/Argon/settings.py +++ b/Argon/settings.py @@ -9,23 +9,17 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/ """ - import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ - # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '*9r6b3_lr!jlk1)f3z&7=)x#b)%089yv0vsc_yeb$k9qwm-z3(' - # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True - ALLOWED_HOSTS = [] - # Application definition - INSTALLED_APPS = [ 'home.apps.HomeConfig', 'accounts.apps.AccountsConfig', @@ -36,8 +30,7 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', -] - + ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -47,9 +40,7 @@ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] - ROOT_URLCONF = 'Argon.urls' - TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', @@ -65,24 +56,17 @@ }, }, ] - WSGI_APPLICATION = 'Argon.wsgi.application' - - # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases - DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } - - # Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators - AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', @@ -109,4 +93,4 @@ STATIC_URL = '/static/' LOGIN_REDIRECT_URL = 'home' LOGOUT_REDIRECT_URL = 'home' -CRISPY_TEMPLATE_PACK = 'bootstrap4' \ No newline at end of file +CRISPY_TEMPLATE_PACK = 'bootstrap4' diff --git a/accounts/apps.py b/accounts/apps.py index 80d5b5f..5ec3fa7 100644 --- a/accounts/apps.py +++ b/accounts/apps.py @@ -1,4 +1,3 @@ from django.apps import AppConfig - class AccountsConfig(AppConfig): name = 'accounts' diff --git a/accounts/forms.py b/accounts/forms.py index 7e3e62c..4747f1b 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -1,12 +1,10 @@ from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm - class SignUpForm(UserCreationForm): first_name = forms.CharField(max_length=30, required=False, ) last_name = forms.CharField(max_length=30, required=False, ) email = forms.EmailField(max_length=50, required=True, ) - - class Meta: + class Meta: model = User fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',) diff --git a/accounts/urls.py b/accounts/urls.py index 5c4b8b2..a3b9144 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -1,6 +1,5 @@ from django.urls import path from accounts.views import SignUpView - urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), ] diff --git a/accounts/views.py b/accounts/views.py index 57d5c10..244a6ec 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -6,15 +6,12 @@ from django.views.generic import TemplateView from django.urls import reverse_lazy from django.contrib import messages - class SignUpView(FormView): form_class = SignUpForm template_name = 'signup.html' - def get(self, request, *args, **kwargs): form = self.form_class(None) return render(request, self.template_name, {'form': form}) - def post(self, request, *args, **kwargs): form = self.form_class(request.POST) if form.is_valid(): @@ -31,5 +28,4 @@ def post(self, request, *args, **kwargs): if user.is_active: login(request, user) return redirect('home') - return render(request, self.template_name, {'form': form}) diff --git a/home/apps.py b/home/apps.py index b7e5fdd..0a2f1bf 100644 --- a/home/apps.py +++ b/home/apps.py @@ -1,4 +1,3 @@ from django.apps import AppConfig - class HomeConfig(AppConfig): name = 'home' diff --git a/home/urls.py b/home/urls.py index 895f413..ebaa65c 100644 --- a/home/urls.py +++ b/home/urls.py @@ -1,6 +1,5 @@ from django.urls import path from .views import HomePageView - urlpatterns = [ path('', HomePageView.as_view(), name='home'), ] diff --git a/home/views.py b/home/views.py index d2ce257..0ed8fce 100644 --- a/home/views.py +++ b/home/views.py @@ -1,4 +1,3 @@ from django.views.generic import TemplateView - class HomePageView(TemplateView): template_name = 'home.html' From d599b3c0c48b02f9f57be29235bc643386d8231e Mon Sep 17 00:00:00 2001 From: haider000 Date: Sat, 17 Aug 2019 10:58:26 +0530 Subject: [PATCH 05/10] runing --- accounts/forms.py | 11 ++++++----- db.sqlite3 | Bin 131072 -> 131072 bytes 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/accounts/forms.py b/accounts/forms.py index 4747f1b..b7263c4 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -2,9 +2,10 @@ from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm class SignUpForm(UserCreationForm): - first_name = forms.CharField(max_length=30, required=False, ) - last_name = forms.CharField(max_length=30, required=False, ) - email = forms.EmailField(max_length=50, required=True, ) + first_name = forms.CharField(max_length=30, required=False, ) + last_name = forms.CharField(max_length=30, required=False, ) + email = forms.EmailField(max_length=50, required=True, ) + class Meta: - model = User - fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',) + model = User + fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',) diff --git a/db.sqlite3 b/db.sqlite3 index ac5546582ab2b1bbbeae8907c5e31c0ff8be525f..9b21a23de2d8bf6a32b39ebfffb7ded33a936056 100644 GIT binary patch delta 558 zcmaiwL2uGv0EYc+5HxOp8zIISFcQrUgRkvMTMQ;ez(~?knoiR1WVKMBv}AnN7A^zz z2e389t9O?yriVpO^A~vV;6V?1^+%}0#Ch=G_05yK&->11vDqxPxB?FMH|~JLHxE$Z zTsj>gXb`-=xE6jaye;3ycm&NM@3=199(ld7$#H##8ne*CIyo|XsNJwp)q=>b`J$~1 z#i`|?f#x-uBsYXd^ z#g=T%Z>pLnQKE-bW1y+ZGOJr?(4wR%vZU!FUz{{}3X=R5{RhzPdp~3XuV) XW$9|u#WTK2SCqLahGdI1m%)~r7 zJt@f~%cL~lu(YB$&&;H(kRd%DkQMV&&9FIH^eE|Kg2B~G94v`HuBLuff#rU=Kv?B#;2-Q|X=Gq%scT@NYh Date: Sat, 17 Aug 2019 12:01:53 +0530 Subject: [PATCH 06/10] modify the code according to pep8 --- Argon/settings.py | 16 +++++++++++----- Argon/urls.py | 5 +++-- accounts/apps.py | 2 ++ accounts/forms.py | 17 ++++++++++------- accounts/urls.py | 2 +- accounts/views.py | 24 ++++++++++++++++-------- home/apps.py | 2 ++ home/urls.py | 2 +- home/views.py | 2 ++ 9 files changed, 48 insertions(+), 24 deletions(-) diff --git a/Argon/settings.py b/Argon/settings.py index 32c5100..1236cc8 100644 --- a/Argon/settings.py +++ b/Argon/settings.py @@ -30,7 +30,7 @@ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - ] +] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -69,16 +69,22 @@ # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + 'NAME': + 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + + }, { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + 'NAME': + 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + 'NAME': + 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + 'NAME': + 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization diff --git a/Argon/urls.py b/Argon/urls.py index 8c61581..6fd8c65 100644 --- a/Argon/urls.py +++ b/Argon/urls.py @@ -21,5 +21,6 @@ path('admin/', admin.site.urls), path('accounts/', include('accounts.urls')), path('', include('home.urls')), - path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), name='login'), - ] + path('login/', + auth_views.LoginView.as_view(template_name='registration/login.html'), + name='login'), ] diff --git a/accounts/apps.py b/accounts/apps.py index 5ec3fa7..9b3fc5a 100644 --- a/accounts/apps.py +++ b/accounts/apps.py @@ -1,3 +1,5 @@ from django.apps import AppConfig + + class AccountsConfig(AppConfig): name = 'accounts' diff --git a/accounts/forms.py b/accounts/forms.py index b7263c4..5a8c0fe 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -1,11 +1,14 @@ from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm + + class SignUpForm(UserCreationForm): - first_name = forms.CharField(max_length=30, required=False, ) - last_name = forms.CharField(max_length=30, required=False, ) - email = forms.EmailField(max_length=50, required=True, ) - - class Meta: - model = User - fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',) + first_name = forms.CharField(max_length=30, required=False, ) + last_name = forms.CharField(max_length=30, required=False, ) + email = forms.EmailField(max_length=50, required=True, ) + + class Meta: + model = User + fields = ('username', 'first_name', 'last_name', + 'email', 'password1', 'password2',) diff --git a/accounts/urls.py b/accounts/urls.py index a3b9144..f548e9f 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -2,4 +2,4 @@ from accounts.views import SignUpView urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), - ] +] diff --git a/accounts/views.py b/accounts/views.py index 244a6ec..27996b6 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,17 +1,23 @@ from django.http import HttpResponseRedirect -from django.shortcuts import render, redirect +from django.shortcuts import render +from django.shortcuts import redirect from django.views.generic.edit import FormView from .forms import SignUpForm -from django.contrib.auth import authenticate, login +from django.contrib.auth import authenticate +from django.contrib.auth import login from django.views.generic import TemplateView from django.urls import reverse_lazy from django.contrib import messages + + class SignUpView(FormView): form_class = SignUpForm template_name = 'signup.html' + def get(self, request, *args, **kwargs): form = self.form_class(None) return render(request, self.template_name, {'form': form}) + def post(self, request, *args, **kwargs): form = self.form_class(request.POST) if form.is_valid(): @@ -19,13 +25,15 @@ def post(self, request, *args, **kwargs): # username = form.cleaned_data['username'] raw_password = form.cleaned_data['password1'] - form.save()#saves the form data - user = authenticate(username=username, password=raw_password)#authenticates the user info - user.set_password(raw_password)#will set the password - user.save()#save the user in the user table - messages.success(request,f'Account created for {username}')#this will show an alert if the account is created succesfully + form.save() # saves the form data + # authenticates the user info + user = authenticate(username=username, password=raw_password) + user.set_password(raw_password) # will set the password + user.save() # save the user in the user table + # this will show an alert if the account is created succesfully + messages.success(request, f'Account created for {username}') if user is not None: - if user.is_active: + if user.is_active: login(request, user) return redirect('home') return render(request, self.template_name, {'form': form}) diff --git a/home/apps.py b/home/apps.py index 0a2f1bf..90dc713 100644 --- a/home/apps.py +++ b/home/apps.py @@ -1,3 +1,5 @@ from django.apps import AppConfig + + class HomeConfig(AppConfig): name = 'home' diff --git a/home/urls.py b/home/urls.py index ebaa65c..f656c91 100644 --- a/home/urls.py +++ b/home/urls.py @@ -2,4 +2,4 @@ from .views import HomePageView urlpatterns = [ path('', HomePageView.as_view(), name='home'), - ] +] diff --git a/home/views.py b/home/views.py index 0ed8fce..72569da 100644 --- a/home/views.py +++ b/home/views.py @@ -1,3 +1,5 @@ from django.views.generic import TemplateView + + class HomePageView(TemplateView): template_name = 'home.html' From bc26b25deddf2d2476ffd9add1f5d44024b46525 Mon Sep 17 00:00:00 2001 From: haider000 Date: Sun, 18 Aug 2019 14:15:27 +0530 Subject: [PATCH 07/10] pep8 --- Argon/settings.py | 4 +--- Argon/urls.py | 4 ++++ Argon/wsgi.py | 2 ++ accounts/urls.py | 2 ++ accounts/views.py | 12 +++++------- db.sqlite3 | Bin 131072 -> 131072 bytes home/urls.py | 2 ++ 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Argon/settings.py b/Argon/settings.py index 1236cc8..1788842 100644 --- a/Argon/settings.py +++ b/Argon/settings.py @@ -70,9 +70,7 @@ AUTH_PASSWORD_VALIDATORS = [ { 'NAME': - 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - - + 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': diff --git a/Argon/urls.py b/Argon/urls.py index 6fd8c65..015c58b 100644 --- a/Argon/urls.py +++ b/Argon/urls.py @@ -13,10 +13,14 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + + from django.contrib import admin from django.urls import path from django.urls import include from django.contrib.auth import views as auth_views + + urlpatterns = [ path('admin/', admin.site.urls), path('accounts/', include('accounts.urls')), diff --git a/Argon/wsgi.py b/Argon/wsgi.py index ba1e5e9..18d5eae 100644 --- a/Argon/wsgi.py +++ b/Argon/wsgi.py @@ -8,5 +8,7 @@ """ import os from django.core.wsgi import get_wsgi_application + + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Argon.settings") application = get_wsgi_application() diff --git a/accounts/urls.py b/accounts/urls.py index f548e9f..0c93007 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -1,5 +1,7 @@ from django.urls import path from accounts.views import SignUpView + + urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), ] diff --git a/accounts/views.py b/accounts/views.py index 27996b6..8d460bb 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,12 +1,9 @@ -from django.http import HttpResponseRedirect from django.shortcuts import render from django.shortcuts import redirect from django.views.generic.edit import FormView from .forms import SignUpForm from django.contrib.auth import authenticate from django.contrib.auth import login -from django.views.generic import TemplateView -from django.urls import reverse_lazy from django.contrib import messages @@ -27,11 +24,12 @@ def post(self, request, *args, **kwargs): raw_password = form.cleaned_data['password1'] form.save() # saves the form data # authenticates the user info - user = authenticate(username=username, password=raw_password) - user.set_password(raw_password) # will set the password + user = authenticate(username=username, + password=raw_password) + user.set_password(raw_password) user.save() # save the user in the user table - # this will show an alert if the account is created succesfully - messages.success(request, f'Account created for {username}') + # this will show an alert if the account is created + messages.success(request, f'Account created for{username}') if user is not None: if user.is_active: login(request, user) diff --git a/db.sqlite3 b/db.sqlite3 index 9b21a23de2d8bf6a32b39ebfffb7ded33a936056..e41c7095c4cced799ac231e872cb1698d898df83 100644 GIT binary patch delta 284 zcmZo@;Am*zm>|u#exi&saQ^m(^BLdA3!s}i{lR}m1pxUYUmO4c delta 400 zcmaiwJx{_w0EWZHh@;Vj{sGMOj)S(F@@0uVLQ`q)76lqgKaPu#rXLF={sE1HBY%L! zFgW`=T;vxxIXNgU4lb@wp1gVTu2#j>s(5!)*xVmC3Y(|v3cp+k;6>^zjzLu<)48W8 zK8Eu;2p2(A zEn5wloi?aV=FG;S?kBzjf4u3$bx1UhR6!jg^g!%;PBF3ih~ym#iFL*ar)kfk34un! zEH|K*xo7Q=1${_z7Lt6N8d+C`KvpY2sURT9vQ`Beh9@div9f)ceU{4q+_ZgNev}We gBr6)KX`p(7Fsdu)cDH`stqbp0rN66>Z(jxJ8>wc8R{#J2 diff --git a/home/urls.py b/home/urls.py index f656c91..141715f 100644 --- a/home/urls.py +++ b/home/urls.py @@ -1,5 +1,7 @@ from django.urls import path from .views import HomePageView + + urlpatterns = [ path('', HomePageView.as_view(), name='home'), ] From 5677414f4b710ed9543e2b117fea3d70213ac319 Mon Sep 17 00:00:00 2001 From: haider000 Date: Sun, 18 Aug 2019 14:30:06 +0530 Subject: [PATCH 08/10] again --- accounts/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/views.py b/accounts/views.py index 8d460bb..7b12a7f 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -24,7 +24,7 @@ def post(self, request, *args, **kwargs): raw_password = form.cleaned_data['password1'] form.save() # saves the form data # authenticates the user info - user = authenticate(username=username, + user = authenticate(username=username, password=raw_password) user.set_password(raw_password) user.save() # save the user in the user table From a9ff297f540718430351300eba5bb07639c19a39 Mon Sep 17 00:00:00 2001 From: haider000 Date: Sun, 18 Aug 2019 14:50:26 +0530 Subject: [PATCH 09/10] pep8 again --- accounts/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/views.py b/accounts/views.py index 7b12a7f..8d460bb 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -24,7 +24,7 @@ def post(self, request, *args, **kwargs): raw_password = form.cleaned_data['password1'] form.save() # saves the form data # authenticates the user info - user = authenticate(username=username, + user = authenticate(username=username, password=raw_password) user.set_password(raw_password) user.save() # save the user in the user table From b1fa59dc0fb9a1e963a4f7ff7ac0d703c626b2f2 Mon Sep 17 00:00:00 2001 From: haider000 Date: Sun, 18 Aug 2019 15:16:49 +0530 Subject: [PATCH 10/10] pep8 again checked --- Argon/settings.py | 45 +++++++++++++++++++++++++++++++++++++-------- Argon/urls.py | 3 ++- Argon/wsgi.py | 4 +++- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Argon/settings.py b/Argon/settings.py index 1788842..07f1839 100644 --- a/Argon/settings.py +++ b/Argon/settings.py @@ -9,17 +9,27 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.0/ref/settings/ """ + import os + # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ + # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '*9r6b3_lr!jlk1)f3z&7=)x#b)%089yv0vsc_yeb$k9qwm-z3(' + # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True + ALLOWED_HOSTS = [] + + # Application definition + INSTALLED_APPS = [ 'home.apps.HomeConfig', 'accounts.apps.AccountsConfig', @@ -31,6 +41,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', ] + MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -40,7 +51,9 @@ 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] + ROOT_URLCONF = 'Argon.urls' + TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', @@ -56,45 +69,61 @@ }, }, ] + WSGI_APPLICATION = 'Argon.wsgi.application' + + # Database # https://docs.djangoproject.com/en/2.0/ref/settings/#databases + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } + + # Password validation # https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators + AUTH_PASSWORD_VALIDATORS = [ { - 'NAME': - 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { - 'NAME': - 'django.contrib.auth.password_validation.MinimumLengthValidator', + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { - 'NAME': - 'django.contrib.auth.password_validation.CommonPasswordValidator', + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { - 'NAME': - 'django.contrib.auth.password_validation.NumericPasswordValidator', + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] + + # Internationalization # https://docs.djangoproject.com/en/2.0/topics/i18n/ + LANGUAGE_CODE = 'en-us' + TIME_ZONE = 'UTC' + USE_I18N = True + USE_L10N = True + USE_TZ = True + + # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.0/howto/static-files/ + STATIC_URL = '/static/' + LOGIN_REDIRECT_URL = 'home' + LOGOUT_REDIRECT_URL = 'home' + CRISPY_TEMPLATE_PACK = 'bootstrap4' diff --git a/Argon/urls.py b/Argon/urls.py index 015c58b..3164db1 100644 --- a/Argon/urls.py +++ b/Argon/urls.py @@ -27,4 +27,5 @@ path('', include('home.urls')), path('login/', auth_views.LoginView.as_view(template_name='registration/login.html'), - name='login'), ] + name='login'), +] diff --git a/Argon/wsgi.py b/Argon/wsgi.py index 18d5eae..c574e74 100644 --- a/Argon/wsgi.py +++ b/Argon/wsgi.py @@ -6,9 +6,11 @@ For more information on this file, see https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ """ + import os -from django.core.wsgi import get_wsgi_application +from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Argon.settings") + application = get_wsgi_application()