diff options
author | shivam kohli <kohlishivam5522@gmail.com> | 2018-08-09 10:21:11 +0530 |
---|---|---|
committer | shivam kohli <kohlishivam5522@gmail.com> | 2018-08-09 10:21:11 +0530 |
commit | 53fbbf0cc0c13c4eb5913e76f76366e61b77e5da (patch) | |
tree | 3d255f542a847a27a0107625095a19fcc5f5707f | |
parent | c7939ec45cc7f68a268c8f11504c9ae13247e1fa (diff) | |
download | codeless-53fbbf0cc0c13c4eb5913e76f76366e61b77e5da.tar.gz codeless-53fbbf0cc0c13c4eb5913e76f76366e61b77e5da.tar.bz2 codeless-53fbbf0cc0c13c4eb5913e76f76366e61b77e5da.zip |
signup page modifield
-rw-r--r-- | inventory/forms.py | 8 | ||||
-rw-r--r-- | inventory/views.py | 4 | ||||
-rw-r--r-- | templates/inventory/signup.html | 51 |
3 files changed, 53 insertions, 10 deletions
diff --git a/inventory/forms.py b/inventory/forms.py index e450a53..15c9a3c 100644 --- a/inventory/forms.py +++ b/inventory/forms.py @@ -27,10 +27,12 @@ from inventory.models import Merchant, Product ADDRESS_CHOICES= [ + ('', '---------'), ('sepa', 'SEPA'), ('upi', 'UPI'), ('bitcoin', 'BITCOIN'), ('ach', 'ACH'), + ('other', 'OTHER'), ] @@ -40,7 +42,8 @@ class SignUpForm(UserCreationForm): email = forms.EmailField(max_length=254) website = forms.URLField(label='Enter website URL', max_length=250, required=False) address = forms.CharField(label='Payment Address type', widget=forms.Select(choices=ADDRESS_CHOICES)) - pay_url = forms.URLField(label='Directly enter the Plain PaytoURI', max_length=250, required=False) + pay_url = forms.URLField(label='Enter the Plain PaytoURI', max_length=250, required=False) + account = forms.CharField(label='Account', max_length=30, required=False) class Meta: model = User @@ -51,9 +54,10 @@ class SignUpForm(UserCreationForm): 'email', 'password1', 'password2', + 'website', 'address', 'pay_url', - 'website' + 'account' ) def __init__(self, *args, **kwargs): diff --git a/inventory/views.py b/inventory/views.py index 958913e..818f134 100644 --- a/inventory/views.py +++ b/inventory/views.py @@ -493,9 +493,11 @@ def signup(request): instance.address = form.cleaned_data.get('address') instance.website = form.cleaned_data.get('website') if form.cleaned_data.get('pay_url'): - instance.address = form.cleaned_data.get('pay_url') + instance.pay_url = form.cleaned_data.get('pay_url') else: #payto URI will be made + account = form.cleaned_data.get('account') + instance.pay_url = "payto://" + instance.address + "/" + account pass instance.save() return redirect('home') diff --git a/templates/inventory/signup.html b/templates/inventory/signup.html index 9d030eb..87c4b63 100644 --- a/templates/inventory/signup.html +++ b/templates/inventory/signup.html @@ -26,7 +26,8 @@ with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>. {% endblock headermsg %} {% block content %} -<div class="main" style="overflow-x: hidden;"> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> + <div class="main" style="overflow-x: hidden;"> <section id="contact"> <div class="container"> <form method="post" enctype="multipart/form-data"> @@ -34,18 +35,16 @@ with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>. {% csrf_token %} <!-- {{ form.as_p }} --> {% for field in form %} - {% if field.label == 'Directly enter the Plain PaytoURI' %} - <br><br><label class="tooltip">{{ field.label }}<font size="1"><span class="tooltiptext">This field is not necessary, if you have choosen the address type.</span></font></label> - {% for error in field.errors %} - <p style="color: red">{{ error }}</p> - {% endfor %} - {{ field }} + {% if field.label == 'Enter the Plain PaytoURI' %} + {% elif field.label == 'Account' %} {% elif field.label == 'Payment Address type' %} <br><br><label class="tooltip">{{ field.label }}<font size="1"><span class="tooltiptext">Choose the type of payment method from the list.</span></font></label> {% for error in field.errors %} <p style="color: red">{{ error }}</p> {% endfor %} {{ field }} + </br></br></br> + {% else %} <label class="mylabel">{{ field.label }}</label> {% for error in field.errors %} @@ -54,10 +53,48 @@ with the Taler Codeless Merchant. If not, see <https://www.gnu.org/licenses/>. {{ field }} {% endif %} {% endfor %} + <!--Topic: other--> + <div id="other" style="display:none"> + <label class="tooltip">{{ form.pay_url.label }}<font size="1"><span class="tooltiptext">Enter the payto URI. This will be the link to which money will be transferred.</span></font></label> + {% for error in field.errors %} + <p style="color: red">{{ error }}</p> + {% endfor %} + {{ form.pay_url }} + </div> + + <!--Topic: default--> + <div id="account" style="display:none"> + <label class="tooltip">{{ form.account.label }}<font size="1"><span class="tooltiptext">Enter the account to which money has to be transferred.</span></font></label> + {% for error in field.errors %} + <p style="color: red">{{ error }}</p> + {% endfor %} + {{ form.account }} + </div> <button name="add_product" type="submit" class="submit">Sign up</button> </form> </div> </section> </div> </div> +<script type="text/javascript"> + $(document).ready(function(){ + $('#id_address').change(function(){ + selection = $(this).val(); + switch(selection) + { + case 'other': + $('#other').show(); + $('#account').hide(); + break; + case '': + $('#other').hide(); + $('#account').hide(); + break; + default: + $('#other').hide(); + $('#account').show(); + break; + } + }); +});</script> {% endblock content %}
\ No newline at end of file |