Skip to content

Commit

Permalink
[Chore] change form layout and add postal field
Browse files Browse the repository at this point in the history
  • Loading branch information
penny-wanjiru committed Aug 3, 2016
1 parent f0010c8 commit 82dc97c
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 674 deletions.
5 changes: 2 additions & 3 deletions troupon/cart/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ class Migration(migrations.Migration):
fields=[
('user_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('street', models.CharField(max_length=250)),
('city', models.CharField(default=b'', max_length=250)),
('zip', models.IntegerField()),
('postal', models.IntegerField()),
('state', models.CharField(max_length=250)),
('telephone', models.IntegerField()),
('userprofile', models.OneToOneField(to='accounts.UserProfile')),
('user', models.OneToOneField(to='accounts.UserProfile')),
],
options={
'abstract': False,
Expand Down
22 changes: 0 additions & 22 deletions troupon/cart/migrations/0002_auto_20160801_0051.py

This file was deleted.

19 changes: 0 additions & 19 deletions troupon/cart/migrations/0003_auto_20160801_0930.py

This file was deleted.

1 change: 1 addition & 0 deletions troupon/cart/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class UserShippingDetails(User):

user = models.OneToOneField(UserProfile)
street = models.CharField(max_length=250)
postal = models.IntegerField()
state = models.CharField(max_length=250)
telephone = models.IntegerField()

Expand Down
19 changes: 10 additions & 9 deletions troupon/cart/templates/cart/shipping.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@
</div>
{% endif %}
{% block main %}
<div class="modal-view" id="modal-sign-in">
<div class="modal-view col-sm-offset-3" id="modal-sign-in">
<div class="row">
<div class="col-sm-5 hidden-xs brand-col">
<div class="brand">
<img src="{% static 'img/logo-v-lg.png' %}" id="logo" alt="Troupon logo">
</div>
</div>
<div class="shippingmdl col-xs-11 col-sm-5" id="shippingmodal">
<div class="shippingmdl col-sm-9" id="shippingmodal">
<header class="row">
<h2>Shipping Details</h2>
<h1>Shipping Details</h1>
</header>
<div class="row">
<div class="col-sm-12">
<div class="col-sm-12 text-center">
<form action="{% url 'proceed_checkout' %}" method="POST">
<input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
<div class="custom-form-group">
Expand All @@ -34,6 +29,12 @@ <h2>Shipping Details</h2>
<input type="text" name="street" id="email" placeholder="1234">
</div>
</div>
<div class="custom-form-group">
<label for="password">Zip/Postal code<span class="label-asterik">*</span></label>
<div class="custom-input-group">
<input type="text" name="postal" id="password" placeholder="Zip/Postal code">
</div>
</div>
<div class="custom-form-group">
<label for="password">State/Province <span class="label-asterik">*</span></label>
<div class="custom-input-group">
Expand Down
Binary file removed troupon/cart/tests/.test_views.py.swp
Binary file not shown.
3 changes: 2 additions & 1 deletion troupon/cart/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ def post(self, request, **kwargs):
"""
street = request.POST.get('street')
state = request.POST.get('state')
postal = request.POST.get('postal')
telephone = request.POST.get('telephone')
user = request.user.profile
shipping = UserShippingDetails(user=user, street=street, state=state, telephone=telephone)
shipping = UserShippingDetails(user=user, street=street, postal=postal, state=state, telephone=telephone)
shipping.save()
return TemplateResponse(request, 'cart/checkout.html')

Expand Down
Loading

0 comments on commit 82dc97c

Please sign in to comment.