Merge pull request #132 from levivm/feature/new_digitalglarus
Added Billing Address success message
This commit is contained in:
commit
5a5b53d4b2
2 changed files with 17 additions and 1 deletions
|
@ -36,13 +36,20 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% bootstrap_form_errors form type='non_fields'%}
|
{% bootstrap_form_errors form type='non_fields'%}
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<button id="payment_button" class="btn btn-primary btn-lg btn-blck " type="submit">Save</button>
|
{% if messages %}
|
||||||
|
{% for message in messages %}
|
||||||
|
<h2 class="signup-lead text-center">{{ message }}</h2>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
<button id="payment_button" class="btn btn-primary btn-lg btn-blck " type="submit">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -473,6 +473,15 @@ class UserBillingAddressView(LoginRequiredMixin, UpdateView):
|
||||||
form_class = UserBillingAddressForm
|
form_class = UserBillingAddressForm
|
||||||
template_name = "digitalglarus/user_billing_address.html"
|
template_name = "digitalglarus/user_billing_address.html"
|
||||||
success_url = reverse_lazy('digitalglarus:user_billing_address')
|
success_url = reverse_lazy('digitalglarus:user_billing_address')
|
||||||
|
success_message = "Billing Address Updated"
|
||||||
|
|
||||||
|
def form_valid(self, form):
|
||||||
|
"""
|
||||||
|
If the form is valid, save the associated model.
|
||||||
|
"""
|
||||||
|
messages.add_message(self.request, messages.SUCCESS, self.success_message)
|
||||||
|
self.object = form.save()
|
||||||
|
return super(UserBillingAddressView, self).form_valid(form)
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
current_billing_address = self.request.user.billing_addresses.first()
|
current_billing_address = self.request.user.billing_addresses.first()
|
||||||
|
|
Loading…
Reference in a new issue