kepas

Untitled

Feb 21st, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. {% block content %}
  2.  
  3.   <h2 class="col-lg-11">Dodaj Oferte </h2>
  4.   <div class="row">
  5.     <div class="innerRow1">
  6.     <div id="content-container" class="container p-none">
  7.         <div class="lgn-container col-lg-8">
  8.     <form  name ="form" id="form" method="post" action="/add_offer/" >
  9.           {% csrf_token %}
  10.           {{form.as_p}}
  11.  
  12.       <script>
  13.          
  14.         var b = {{form.typeof}}
  15.         var c = {{form.price}}
  16.         if(b == 1){
  17.             document.getElementById("id_amount_of_provision").value = 0  
  18.         }
  19.         else if(b == 2){
  20.           document.getElementById("id_amount_of_provision").value = 25
  21.         }
  22.         else if(b == 3){
  23.         document.getElementById("id_amount_of_provision").value = c*0.05
  24.         }
  25.  
  26.         </script>
  27.         <button type="submit">Zapisz</button>
  28.         </form>
  29.       </div>
  30.     </div>
  31.   </div>
  32. </div>
  33.  
  34. ####################################################################################################
  35. class OfferForm(ModelForm):
  36.     class Meta:
  37.         model = Offer
  38.         fields = ['title','content','price','contact','photo','typeof','amount_of_provision']
  39.         widgets = {'amount_of_provision': forms.HiddenInput}
Advertisement
Add Comment
Please, Sign In to add comment