diff --git a/project/customer/views/license.py b/project/customer/views/license.py index fa8a4d5..c5fd41a 100644 --- a/project/customer/views/license.py +++ b/project/customer/views/license.py @@ -20,6 +20,7 @@ def order_license(request): dictionary = { 'form': form, } + if form.is_valid(): new_license = License(user=request.user, term=form.cleaned_data['term'].term, diff --git a/project/static/js/license.js b/project/static/js/license.js new file mode 100644 index 0000000..91ce213 --- /dev/null +++ b/project/static/js/license.js @@ -0,0 +1,18 @@ +$(document).ready(function() { + function show_month() { + var terms = $('[name="term"]'); + if ($('[name="payform"]:checked').val() == '0'){ + $(terms[0]).closest('li').hide(); + if (terms.index(terms.filter(':checked')) == 0){ + $(terms[1]).prop('checked', true); + } + } else { + $($('[name="term"]')[0]).closest('li').show(); + } + } + show_month(); + $('[name="payform"]').change(function(){ + show_month() + }); +}); + diff --git a/project/templates/customer/profile/license.html b/project/templates/customer/profile/license.html index 6ff043b..549e36f 100644 --- a/project/templates/customer/profile/license.html +++ b/project/templates/customer/profile/license.html @@ -34,3 +34,8 @@ {% endblock %} + +{% block js %} + +{% endblock %} +