From 83de1d142dda686bfa6a162f8f06a3c4ef431841 Mon Sep 17 00:00:00 2001 From: hemal Date: Fri, 8 Feb 2019 22:30:56 +0530 Subject: [PATCH] Edit profile change --- accounts/__pycache__/forms.cpython-36.pyc | Bin 1512 -> 1512 bytes accounts/__pycache__/views.cpython-36.pyc | Bin 3487 -> 3420 bytes .../templates/accounts/change_password.html | 16 ++- accounts/templates/accounts/editprofile.html | 27 ++++- accounts/templates/accounts/profile.html | 112 +++++++++--------- accounts/templates/base.html | 31 ++--- accounts/views.py | 8 +- db.sqlite3 | Bin 167936 -> 167936 bytes 8 files changed, 102 insertions(+), 92 deletions(-) diff --git a/accounts/__pycache__/forms.cpython-36.pyc b/accounts/__pycache__/forms.cpython-36.pyc index ab8ada90d3547fd0ef542cd08351bc76b67caf01..79bff2dc0fcd98fa946ad5f9f8a7a27b27cb0f87 100644 GIT binary patch delta 16 XcmaFC{eqj_n3tDp!PeM~>L7=A>3hz(tZX X67$kibqf-Ui_7ziQa0CcDKi5Ap}ZN@ delta 122 zcmca3HD8+3n3tC;TFyTvX(Q(m4so@Nl9B=|ef^yLxlq*m!;H)OIRmjt8!W=k$*W&mocCdvQ+ diff --git a/accounts/templates/accounts/change_password.html b/accounts/templates/accounts/change_password.html index 73bae35..74bbb1b 100644 --- a/accounts/templates/accounts/change_password.html +++ b/accounts/templates/accounts/change_password.html @@ -7,10 +7,20 @@ visibility: hidden; } -
-
+
+ {% csrf_token %} - {{ form.as_p }} + + {% for field in form %} + + + {% for error in field.errors %} +

{{ error }}

+ {% endfor %} + + + {% endfor %} +
{{ field.label_tag }}{{ field }}
 
diff --git a/accounts/templates/accounts/editprofile.html b/accounts/templates/accounts/editprofile.html index 41c1086..63fd1fe 100644 --- a/accounts/templates/accounts/editprofile.html +++ b/accounts/templates/accounts/editprofile.html @@ -1,12 +1,27 @@ {%extends 'base.html'%} {%block head%}Edit Profile Page{%endblock%} {%block body%} -
-
+
+

Sign up

+ {% csrf_token %} - {{ form.as_p }} -
- - + + {% for field in form %} + + {% if field.name != 'password'%} + + + {% for error in field.errors %} +

{{ error }}

+ {% endfor %} + {% else %} + + {%endif%} + + + {% endfor %} +
{{ field.label_tag }}{{ field }}Password: Click here to change password
 
+ +
{%endblock%} \ No newline at end of file diff --git a/accounts/templates/accounts/profile.html b/accounts/templates/accounts/profile.html index 087802a..8e8e8c3 100644 --- a/accounts/templates/accounts/profile.html +++ b/accounts/templates/accounts/profile.html @@ -1,79 +1,75 @@ {%extends 'base.html'%} {%block head%}User Profile{%endblock%} {%block body%} -
+
-
-

Welcome {{ user.get_full_name}}

-

Profile Details

-
-
-
-



- - -
- -

-
+

Welcome {{ user.get_full_name}}

+

Profile Details

+
+
+

+ +
+ +

-
- +
+
+ +

+
+

-
- -

-
+
-
- +
+ +

+
+

-
- -

-
-
- +
+
+ +

+
+

-
- -

-
-
- +
+
+ +

+
+

-
- -

-
-
- +
+
+ +

+
+

-
- -

-
-
- +
+
+ +

+
+

-
- -

-
-
+ {%endblock%} \ No newline at end of file diff --git a/accounts/templates/base.html b/accounts/templates/base.html index f6d1671..ea371d7 100644 --- a/accounts/templates/base.html +++ b/accounts/templates/base.html @@ -12,10 +12,6 @@ z-index: 1; } - body { - background-color: #84CEEB; - } - .button { display: inline-block; padding: 10px 20px; @@ -62,21 +58,7 @@ Base {% endblock %} - - - + diff --git a/accounts/views.py b/accounts/views.py index 2396d53..6f2ceed 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -75,11 +75,11 @@ def editprofile(request): form = EditProfileForm(request.POST, instance=request.user) if form.is_valid(): form.save() - return redirect('http://localhost:8000/accounts/profile') + return redirect('accounts/profile') else: form = EditProfileForm(instance=request.user) args = {'form': form} - return render(request,'accounts/editprofile.html',args) + return render(request,'accounts/editprofile.html', args) def change_password(request): if request.method == 'POST': @@ -87,9 +87,9 @@ def change_password(request): if form.is_valid(): form.save() update_session_auth_hash(request,form.user) - return redirect('http://localhost:8000/accounts/profile') + return redirect('accounts/profile') else: - return redirect('http://localhost:8000/accounts/change-password/') + return redirect('accounts/change-password') else: form = PasswordChangeForm(user=request.user) args = {'form': form} diff --git a/db.sqlite3 b/db.sqlite3 index e1bfceeef44432f8fec943fbcfc4f446218aa8d9..ce3bf18a57668ab990cca1129248d72641beab87 100644 GIT binary patch delta 217 zcmZozz}2vTYl0LLBlAQVCm^{oVaqH*3k5?nD?>voV^ckIa}y&=lg+BLKfAE-xG_)J z>?lydtkGmG!0Ow=>S$_~QEHx8m0w|IW{{s&W@1rZP-d8$UsY;sVP27LnzlLb4GW`? zkrBc?3v**LQ_JQ{Pqtrr!g!EVm5>PnD$Kr&lW#py*nZ<3qXQ!g{}R5_n-vw-^G!ef SkC8_h(`bS1ul_NLO#}cb-bBy< delta 213 zcmZozz}2vTYl0LL!~cmgPC#;F!j@TrMhb?eR)!{4M#g$(=7y$*=9^V#e|BMEp2Fj{ z*-@Z^S)<9CkJYz@)zPRVsnWDCDL=CyE6F@P)gV75&C)Q_u(%-Iw74`SwPe6=q+?$+w;;Y`^i2(SebL?==6C&58=^ b`KF)#$H*gWXr=&kBeKza+h6@-6q^VDVnatg