Skip to content

Commit ff35198

Browse files
Added Working Feature
1 parent eeda866 commit ff35198

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

junction/profiles/views.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
from django.contrib.auth.decorators import login_required
66
from django.shortcuts import render
77
from django.views.decorators.http import require_http_methods
8+
from django.http import HttpResponseRedirect
89

910
# Junction Stuff
1011
from junction.conferences.models import Conference
1112

13+
#Profile Stuff
14+
from .models import Profile
15+
1216

1317
@login_required
1418
@require_http_methods(['GET'])
@@ -26,4 +30,10 @@ def dashboard(request):
2630

2731
@login_required
2832
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')

junction/templates/profiles/userprofile.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<div class="form-container space-2-bottom {% if form.errors %} has-error {% endif %}">
3232
<h2 class="text-center">Edit Profile</h2>
3333
<div class="pad-2 push-half-top push-2-bottom">
34-
<p> {% block trans %} Add Your City and Contact Number: {% endblock %} </p>
3534
<form class="form-horizontal login-form" method="POST">
3635
{% csrf_token %}
3736
<div class="form-group">
@@ -43,21 +42,19 @@ <h2 class="text-center">Edit Profile</h2>
4342
<div class="form-group">
4443
<label for="contact" class="col-lg-4 control-label"> Contact :</label>
4544
<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">
4746
</div>
4847
</div>
4948
<div class="form-group">
5049
<div class="col-lg-8 col-lg-offset-4">
5150
<button class="btn btn-primary" type="submit">
5251
Submit
5352
</button>
53+
</div>
5454
</div>
55-
5655
</form>
5756
</div>
5857
</div>
5958
</div>
6059
</div>
61-
62-
6360
{% endblock %}

0 commit comments

Comments
 (0)