File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 5
5
from django .contrib .auth .decorators import login_required
6
6
from django .shortcuts import render
7
7
from django .views .decorators .http import require_http_methods
8
+ from django .http import HttpResponseRedirect
8
9
9
10
# Junction Stuff
10
11
from junction .conferences .models import Conference
11
12
13
+ #Profile Stuff
14
+ from .models import Profile
15
+
12
16
13
17
@login_required
14
18
@require_http_methods (['GET' ])
@@ -26,4 +30,10 @@ def dashboard(request):
26
30
27
31
@login_required
28
32
def profile (request ):
29
- return render (request , 'profiles/userprofile.html' )
33
+ if request .method == "POST" :
34
+ city = request .POST ['city' ]
35
+ contact_no = request .POST ['contact_no' ]
36
+ Profile .objects .create (user = request .user , city = city , contact_no = contact_no )
37
+ return HttpResponseRedirect ("/profile" )
38
+ elif request .method == "GET" :
39
+ return render (request , 'profiles/userprofile.html' )
Original file line number Diff line number Diff line change 31
31
< div class ="form-container space-2-bottom {% if form.errors %} has-error {% endif %} ">
32
32
< h2 class ="text-center "> Edit Profile</ h2 >
33
33
< div class ="pad-2 push-half-top push-2-bottom ">
34
- < p > {% block trans %} Add Your City and Contact Number: {% endblock %} </ p >
35
34
< form class ="form-horizontal login-form " method ="POST ">
36
35
{% csrf_token %}
37
36
< div class ="form-group ">
@@ -43,21 +42,19 @@ <h2 class="text-center">Edit Profile</h2>
43
42
< div class ="form-group ">
44
43
< label for ="contact " class ="col-lg-4 control-label "> Contact :</ label >
45
44
< div class ="col-lg-8 ">
46
- < input autofocus ="autofocus " name ="contact " placeholder ="Enter Your Contact No: " type ="text ">
45
+ < input autofocus ="autofocus " name ="contact_no " placeholder ="Enter Your Contact No: " type ="text ">
47
46
</ div >
48
47
</ div >
49
48
< div class ="form-group ">
50
49
< div class ="col-lg-8 col-lg-offset-4 ">
51
50
< button class ="btn btn-primary " type ="submit ">
52
51
Submit
53
52
</ button >
53
+ </ div >
54
54
</ div >
55
-
56
55
</ form >
57
56
</ div >
58
57
</ div >
59
58
</ div >
60
59
</ div >
61
-
62
-
63
60
{% endblock %}
You can’t perform that action at this time.
0 commit comments