Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread wongX Ndeso
You can use django form wizard if you want, much easier than you should
manipulate the onclick event using javascript or something similar with
that..
Maybe you should remodel your form or the flow.. Hope this help


On Sun, Jun 7, 2020, 1:34 PM Sai  wrote:

> Hi guys,
> I am working on a* Django project,* which involves submission form and
> saving the data in the database using model form.  I am stuck with one of
> the functionalities of form which should work like for example "do you want
> benefit plan: *YES,* *next Field options should pop up*. if click* NO,
> nothing should happen* and move to the next question."
>
> I went through all over the internet and found the dependent drop-down
> select option but not like field pop up as we click through te form.
>
> Please let me know how to achieve this in a clear way as I am new to
> Django and programming as well.
>
> Thank You so much in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0c8d8457-b2d8-4598-aa0d-b9b05e817722o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJepfJUBQZHVN9%3DBBQJkPy1iMd%3D0mE7rOQjwWb4U%2BdwBo3Jd0g%40mail.gmail.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread Ernest Thuku
I think that you will have to use something like JavaScript in the model
forms

On Sun, Jun 7, 2020, 09:34 Sai  wrote:

> Hi guys,
> I am working on a* Django project,* which involves submission form and
> saving the data in the database using model form.  I am stuck with one of
> the functionalities of form which should work like for example "do you want
> benefit plan: *YES,* *next Field options should pop up*. if click* NO,
> nothing should happen* and move to the next question."
>
> I went through all over the internet and found the dependent drop-down
> select option but not like field pop up as we click through te form.
>
> Please let me know how to achieve this in a clear way as I am new to
> Django and programming as well.
>
> Thank You so much in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0c8d8457-b2d8-4598-aa0d-b9b05e817722o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPsfuodduYpLU%3DTVgfbWgvNe-UQTQN7PVQ_3US8hswd8vut2Mw%40mail.gmail.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread Shyam Acharjya
If anyone has done this before.plese share the sollution.thnx

On Sun, Jun 7, 2020 at 3:52 PM wongX Ndeso  wrote:

> You can use django form wizard if you want, much easier than you should
> manipulate the onclick event using javascript or something similar with
> that..
> Maybe you should remodel your form or the flow.. Hope this help
>
>
> On Sun, Jun 7, 2020, 1:34 PM Sai  wrote:
>
>> Hi guys,
>> I am working on a* Django project,* which involves submission form and
>> saving the data in the database using model form.  I am stuck with one of
>> the functionalities of form which should work like for example "do you want
>> benefit plan: *YES,* *next Field options should pop up*. if click* NO,
>> nothing should happen* and move to the next question."
>>
>> I went through all over the internet and found the dependent drop-down
>> select option but not like field pop up as we click through te form.
>>
>> Please let me know how to achieve this in a clear way as I am new to
>> Django and programming as well.
>>
>> Thank You so much in advance.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/0c8d8457-b2d8-4598-aa0d-b9b05e817722o%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAJepfJUBQZHVN9%3DBBQJkPy1iMd%3D0mE7rOQjwWb4U%2BdwBo3Jd0g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPxLkSSxqbe6h9ZDvoyUX3cOJFN6uQhmpOGL9bNX6xnTCAAQzQ%40mail.gmail.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread Shyam Acharjya
hi AMINE AZIZ. for frontend what approach should be taken?
thnx

On Sunday, June 7, 2020 at 7:19:28 PM UTC+5:30, AMINE AZIZ wrote:
>
> Hi 
>
> You need to use some JQUERY code 
>
> You need this in admin or frontend ? 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9bb961c9-740b-44c5-8197-6e226ecd70edo%40googlegroups.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread chaitanya orakala
Thanks for the response guys. I see many of them are saying need to use
javascript or jquery.

Is there any reference links to achieve that? ?

On Sun, Jun 7, 2020 at 10:00 AM Shyam Acharjya 
wrote:

> hi AMINE AZIZ. for frontend what approach should be taken?
> thnx
>
> On Sunday, June 7, 2020 at 7:19:28 PM UTC+5:30, AMINE AZIZ wrote:
>>
>> Hi
>>
>> You need to use some JQUERY code
>>
>> You need this in admin or frontend ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9bb961c9-740b-44c5-8197-6e226ecd70edo%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPcTzRbL7bi5UYQe40RH90yuLHTVM4RCAo5DAZZ%3DbsgtyEoczQ%40mail.gmail.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread AMINE AZIZ
You 'll use JQUERY normal  as the same in html

You need every html id (so you cab add on change) 

JQUERY on change select 
Show hidden popup / or show hidden input 

Share your code. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/45f6db02-6231-4e49-b97a-93565012abf9o%40googlegroups.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread chaitanya orakala
*sure, here is my code*. please let me know how can I modify this to
achieve a dependent drop fields.
I want it to make action on executive_authority, next fields should pop-up

*Views.py*

from django.shortcuts import render, redirect
from er_form.forms import NewClientForm, BillingGroupForm
from django.template.context_processors import csrf

def index(request):
context = {}
return render(request, 'er_form/index.html', context)


def client(request):
if request.method == 'POST':
client_form = NewClientForm(request.POST)
billing_form = BillingGroupForm(request.POST) #saving the
instance

if client_form.is_valid() and billing_form.is_valid():
form = client_form.save()
bform = billing_form.save(commit=False) #to create
relatnshp between 2forms,dont save just collect instance

bform.form = form   #creating rltnshp between two forms
bform.client_id=1
bform.save()#saving both forms

return redirect('client')

else:
client_form = NewClientForm()
billing_form = BillingGroupForm()
args = {}
args.update(csrf(request))
args['client_form'] = client_form
args['billing_form'] = billing_form

return render(request, "er_form/client.html", args)

*models.py*

from __future__ import unicode_literals
from django.utils import timezone
from django.db import models
from datetime import datetime, date, timedelta
from django.core.validators import RegexValidator

# Create your models here.
#New Client model
class NewClient(models.Model):
#choices for selection


status_choice = [
('active', 'Active'),
('inactive', 'In-Active'),
]

#User Input Feilds
business_name = models.CharField(max_length=1024, help_text='Enter Your
Business Name')
legal_name = models.CharField(max_length=1024, help_text='Enter Legal
Name, if different from the Business')
nature_of_business = models.CharField(max_length=1024)
years_in_business = models.PositiveIntegerField(default=0)
company_type = models.CharField(max_length=20)
#Data provided by Tool to reflect in Database
association_name = models.CharField(max_length=20, default='OCIBP')
group = models.CharField(max_length=30, default='', null=True)
code = models.CharField(max_length=10, default='000')
status = models.CharField(max_length=15, choices=status_choice,
default='active')

anniversery_date=models.DateTimeField(default=datetime.now()+timedelta(days=365))
service_rep = models.CharField(max_length=50, default='Carolina')
sales_person = models.CharField(max_length=50, default='Robert Perusco')
renewal_agent = models.CharField(max_length=50, default='Merit Ontario')
first_billing_period = models.DateField(auto_now_add=True)
created_on = models.DateField(auto_now=True)
created_by = models.DateField(null=True)
last_updated_on = models.DateField(null=True)
last_updated_by = models.DateField(null=True)
current_state = models.CharField(max_length=15, default='open')
original_service_date = models.DateField(auto_now_add=True)
cert_length = models.PositiveIntegerField(null=True)
cert_start = models.DateField(null=True)
require_pin = models.CharField(max_length=15, null=True)
require_alt_pin = models.CharField(max_length=15, null=True)





def __str__(self):
return self.business_name

#BillingGroup Model

class BillingGroup(models.Model):
client = models.ForeignKey(NewClient)
name = models.CharField(max_length=1024, default='Administration Fee')
billing_type = models.CharField(max_length=1024, default='Per Person
Charge')
remit_to = models.CharField(max_length=1024, default = 'BSL')
language = models.CharField(max_length=50, default='English')
legacy_system_code = models.CharField(max_length=20, null=True)
carrier_division_code = models.CharField(max_length=20, null=True)
invoice_override = models.CharField(max_length=20, null=True)
address_1 = models.CharField("Address line 1",max_length=1024,)
address_2 = models.CharField("Address line 2",max_length=1024,)
city = models.CharField("City",max_length=1024,)
province = models.CharField("Province",max_length=30,)
country = models.CharField("Country", max_length=30)
zip_code = models.CharField("ZIP / Postal code",max_length=12,)
first_name = models.CharField("First Name", max_length=30, )
last_name = models.CharField("Last Name", max_length=30,)
title = models.CharField("Title/Position", max_length=1024)
email = models.EmailField("Authorized - Email", max_length=254)
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone
number must be entered in the format: '+9'. Up to 15 digits
allowed.")
phone_number = models.CharField(validators=[phone_regex],
max_length=17, blank=True) # validators should be a list
fax = models.CharField(max_lengt

Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread chaitanya orakala
Can anyone suggest how to approch this???

On Sun., Jun. 7, 2020, 12:09 p.m. chaitanya orakala, <
chaitu.orak...@gmail.com> wrote:

> *sure, here is my code*. please let me know how can I modify this to
> achieve a dependent drop fields.
> I want it to make action on executive_authority, next fields should pop-up
>
> *Views.py*
> 
> from django.shortcuts import render, redirect
> from er_form.forms import NewClientForm, BillingGroupForm
> from django.template.context_processors import csrf
>
> def index(request):
> context = {}
> return render(request, 'er_form/index.html', context)
>
>
> def client(request):
> if request.method == 'POST':
> client_form = NewClientForm(request.POST)
> billing_form = BillingGroupForm(request.POST) #saving the
> instance
>
> if client_form.is_valid() and billing_form.is_valid():
> form = client_form.save()
> bform = billing_form.save(commit=False) #to create
> relatnshp between 2forms,dont save just collect instance
>
> bform.form = form   #creating rltnshp between two forms
> bform.client_id=1
> bform.save()#saving both forms
>
> return redirect('client')
>
> else:
> client_form = NewClientForm()
> billing_form = BillingGroupForm()
> args = {}
> args.update(csrf(request))
> args['client_form'] = client_form
> args['billing_form'] = billing_form
>
> return render(request, "er_form/client.html", args)
> 
> *models.py*
> 
> from __future__ import unicode_literals
> from django.utils import timezone
> from django.db import models
> from datetime import datetime, date, timedelta
> from django.core.validators import RegexValidator
>
> # Create your models here.
> #New Client model
> class NewClient(models.Model):
> #choices for selection
>
>
> status_choice = [
> ('active', 'Active'),
> ('inactive', 'In-Active'),
> ]
>
> #User Input Feilds
> business_name = models.CharField(max_length=1024, help_text='Enter
> Your Business Name')
> legal_name = models.CharField(max_length=1024, help_text='Enter Legal
> Name, if different from the Business')
> nature_of_business = models.CharField(max_length=1024)
> years_in_business = models.PositiveIntegerField(default=0)
> company_type = models.CharField(max_length=20)
> #Data provided by Tool to reflect in Database
> association_name = models.CharField(max_length=20, default='OCIBP')
> group = models.CharField(max_length=30, default='', null=True)
> code = models.CharField(max_length=10, default='000')
> status = models.CharField(max_length=15, choices=status_choice,
> default='active')
>
> anniversery_date=models.DateTimeField(default=datetime.now()+timedelta(days=365))
> service_rep = models.CharField(max_length=50, default='Carolina')
> sales_person = models.CharField(max_length=50, default='Robert
> Perusco')
> renewal_agent = models.CharField(max_length=50, default='Merit
> Ontario')
> first_billing_period = models.DateField(auto_now_add=True)
> created_on = models.DateField(auto_now=True)
> created_by = models.DateField(null=True)
> last_updated_on = models.DateField(null=True)
> last_updated_by = models.DateField(null=True)
> current_state = models.CharField(max_length=15, default='open')
> original_service_date = models.DateField(auto_now_add=True)
> cert_length = models.PositiveIntegerField(null=True)
> cert_start = models.DateField(null=True)
> require_pin = models.CharField(max_length=15, null=True)
> require_alt_pin = models.CharField(max_length=15, null=True)
>
>
>
>
>
> def __str__(self):
> return self.business_name
>
> #BillingGroup Model
>
> class BillingGroup(models.Model):
> client = models.ForeignKey(NewClient)
> name = models.CharField(max_length=1024, default='Administration Fee')
> billing_type = models.CharField(max_length=1024, default='Per Person
> Charge')
> remit_to = models.CharField(max_length=1024, default = 'BSL')
> language = models.CharField(max_length=50, default='English')
> legacy_system_code = models.CharField(max_length=20, null=True)
> carrier_division_code = models.CharField(max_length=20, null=True)
> invoice_override = models.CharField(max_length=20, null=True)
> address_1 = models.CharField("Address line 1",max_length=1024,)
> address_2 = models.CharField("Address line 2",max_length=1024,)
> city = models.CharField("City",max_length=1024,)
> province = models.CharField("Province",max_length=30,)
> country = models.CharField("Country", max_length=30)
> zip_code = models.CharField("ZIP / Postal code",max_length=12,)
> first_name = models.CharField("First Name", max_length=30, )
> last_name = models.CharField("Last Name", max_length=30,)
> title = models.CharField("Title/Position", max_length=1024)
> email = models.

Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread AMINE AZIZ
I will share with you my iwn code used in admin , but it still the same as 
the front end 

withe jQuery i can show input or hide it , so you will do the same with 
popup , by default it will be display none, and with Jquery you can show it 
if user change value to yes dropdown (select)







$(document).on("change", "select", function(){

idChangedSelect=$(this).attr("id")
if (idChangedSelect.indexOf("-multiPartenairePP") >= 0) // verify if 
the changed select is Partenaire
{

  var 
total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
var SelectNumber =  getSubStr(idChangedSelect, '-')
 SelectedValuePartenaire=$(this).val()
 //alert(SelectNumber)
 rse=SelectNumber*total_partenaire
if (SelectedValuePartenaire==2){ // Etat


$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiAdefinir").val('');

$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiGouvernementPP").val('');

$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPaysPP").val('');
$("[id=div-2-multiEtatPP]:eq("+SelectNumber+")").show()


$("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
$("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
   $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
$("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").hide();
// $("#id_adefinir").prop("selectedIndex", 1);
 }

  else if (SelectedValuePartenaire==3){//Gouvernement
  
$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiEtatPP").val('');

$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiAdefinir").val('');



$("[id=div-2-multiEtatPP]:eq("+SelectNumber+")").hide();
$("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
  $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
   $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").hide();

 
if($("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiGouvernementPP
 option").length<=1)
 {
$("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
 //$("#id_paysP").prop("selectedIndex", 1);
 }
 else 
if($("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiGouvernementPP
 option").length>1)
 {

$("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").show();

  //-  
$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPaysPP").val('');
  //   $("#id_gouvernement").prop("selectedIndex", 1);
 }
 }
else if (SelectedValuePartenaire==4){//Ministére
  
$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiEtatPP").val('');




$("[id=div-2-multiEtatPP]:eq("+SelectNumber+")").hide();
$("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").show();
  $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
   $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").hide();

 
if($("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiGouvernementPP
 option").length<=1)
 {
$("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
 //$("#id_paysP").prop("selectedIndex", 1);
 }
 else 
if($("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiGouvernementPP
 option").length>1)
 {

$("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").show();

   //- 
$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPaysPP").val('');
  //   $("#id_gouvernement").prop("selectedIndex", 1);
 }
 }
   else if (SelectedValuePartenaire==5){//Département Ministériel
  
$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiEtatPP").val('');




$("[id=div-2-multiEtatPP]:eq("+SelectNumber+")").hide();
$("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").show();
  $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
   $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").hide();

 
if($("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiGouvernementPP
 option").length<=1)
 {
$("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
 //$("#id_paysP").prop("selectedIndex", 1);
 }
 else 
if($("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiGouvernementPP
 option").length>1)
 {

$("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").show();


//-$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPaysPP").val('');
  //   $("#id_gouverne

Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-07 Thread AMINE AZIZ
I will share with you my iwn code used in admin , but it still the same as 
the front end 

withe jQuery i can show input or hide it , so you will do the same with 
popup , by default it will be display none, and with Jquery you can show it 
if user change value to yes dropdown (select)

you will use id div of pupup to show it or hide it 


if (!$) {
// Need this line because Django also provided jQuery and namespaced as 
django.jQuery
$ = django.jQuery;
}



$(document).ready(function() {

$("#id_paysPartenaires").change(function()
{

   

 var 
total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
var SelectNumber =  i
 
SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
 //alert(SelectNumber)




$("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();

$("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
   
$("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();

$("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
  }   


});


Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :
>
> Hi guys,
> I am working on a* Django project,* which involves submission form and 
> saving the data in the database using model form.  I am stuck with one of 
> the functionalities of form which should work like for example "do you want 
> benefit plan: *YES,* *next Field options should pop up*. if click* NO, 
> nothing should happen* and move to the next question."  
>
> I went through all over the internet and found the dependent drop-down 
> select option but not like field pop up as we click through te form.
>
> Please let me know how to achieve this in a clear way as I am new to 
> Django and programming as well.
>
> Thank You so much in advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3f3bf262-7fac-4818-836e-dc8532dae707o%40googlegroups.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-08 Thread chaitanya orakala
Thank You, Amine Aziz. I tried jquery and it worked. its so simple once we
know jquery.
do help others like you did to me.

On Sun, Jun 7, 2020 at 1:18 PM AMINE AZIZ  wrote:

> I will share with you my iwn code used in admin , but it still the same as
> the front end
>
> withe jQuery i can show input or hide it , so you will do the same with
> popup , by default it will be display none, and with Jquery you can show it
> if user change value to yes dropdown (select)
>
> you will use id div of pupup to show it or hide it
>
>
> if (!$) {
> // Need this line because Django also provided jQuery and namespaced as 
> django.jQuery
> $ = django.jQuery;
> }
>
>
>
> $(document).ready(function() {
>
> $("#id_paysPartenaires").change(function()
> {
>
>
>
>  var 
> total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
> var SelectNumber =  i
>  
> SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
>  //alert(SelectNumber)
>
>
>
> 
> $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
> 
> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>
> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
> 
> $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
>   }
>
>
> });
>
>
> Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :
>>
>> Hi guys,
>> I am working on a* Django project,* which involves submission form and
>> saving the data in the database using model form.  I am stuck with one of
>> the functionalities of form which should work like for example "do you want
>> benefit plan: *YES,* *next Field options should pop up*. if click* NO,
>> nothing should happen* and move to the next question."
>>
>> I went through all over the internet and found the dependent drop-down
>> select option but not like field pop up as we click through te form.
>>
>> Please let me know how to achieve this in a clear way as I am new to
>> Django and programming as well.
>>
>> Thank You so much in advance.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3f3bf262-7fac-4818-836e-dc8532dae707o%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPcTzRabB90jUEuYj1v-9JWdOMqqsM4fjN-TEq1CwOcwEPX1zA%40mail.gmail.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-08 Thread Balaji Shetty
Nice

Can you please share sample code on git link.

This is very common requirement in every project



On Tuesday, June 9, 2020, chaitanya orakala 
wrote:

> Thank You, Amine Aziz. I tried jquery and it worked. its so simple once we
> know jquery.
> do help others like you did to me.
>
> On Sun, Jun 7, 2020 at 1:18 PM AMINE AZIZ  wrote:
>
>> I will share with you my iwn code used in admin , but it still the same
>> as the front end
>>
>> withe jQuery i can show input or hide it , so you will do the same with
>> popup , by default it will be display none, and with Jquery you can show it
>> if user change value to yes dropdown (select)
>>
>> you will use id div of pupup to show it or hide it
>>
>>
>> if (!$) {
>> // Need this line because Django also provided jQuery and namespaced as 
>> django.jQuery
>> $ = django.jQuery;
>> }
>>
>>
>>
>> $(document).ready(function() {
>>
>> $("#id_paysPartenaires").change(function()
>> {
>>
>>
>>
>>  var 
>> total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
>> var SelectNumber =  i
>>  
>> SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
>>  //alert(SelectNumber)
>>
>>
>>
>> 
>> $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
>> 
>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>>
>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>> 
>> $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
>>   }
>>
>>
>> });
>>
>>
>> Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :
>>>
>>> Hi guys,
>>> I am working on a* Django project,* which involves submission form and
>>> saving the data in the database using model form.  I am stuck with one of
>>> the functionalities of form which should work like for example "do you want
>>> benefit plan: *YES,* *next Field options should pop up*. if click* NO,
>>> nothing should happen* and move to the next question."
>>>
>>> I went through all over the internet and found the dependent drop-down
>>> select option but not like field pop up as we click through te form.
>>>
>>> Please let me know how to achieve this in a clear way as I am new to
>>> Django and programming as well.
>>>
>>> Thank You so much in advance.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/3f3bf262-7fac-4818-836e-dc8532dae707o%
>> 40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAPcTzRabB90jUEuYj1v-9JWdOMqqsM4fjN-
> TEq1CwOcwEPX1zA%40mail.gmail.com
> 
> .
>


-- 
Mr Shetty Balaji
Asst. Prof.
IT Department
SGGS I&T
Nanded. My. India

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAECSbOt4OiS_WLAucNWQtwpWuZ_LZe1hXyM4%3DFXZzmm6mSVGHw%40mail.gmail.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-09 Thread chaitanya orakala
sure, I will do it by tomorrow


On Tue, Jun 9, 2020 at 2:35 AM Balaji Shetty  wrote:

> Nice
>
> Can you please share sample code on git link.
>
> This is very common requirement in every project
>
>
>
> On Tuesday, June 9, 2020, chaitanya orakala 
> wrote:
>
>> Thank You, Amine Aziz. I tried jquery and it worked. its so simple once
>> we know jquery.
>> do help others like you did to me.
>>
>> On Sun, Jun 7, 2020 at 1:18 PM AMINE AZIZ  wrote:
>>
>>> I will share with you my iwn code used in admin , but it still the same
>>> as the front end
>>>
>>> withe jQuery i can show input or hide it , so you will do the same with
>>> popup , by default it will be display none, and with Jquery you can show it
>>> if user change value to yes dropdown (select)
>>>
>>> you will use id div of pupup to show it or hide it
>>>
>>>
>>> if (!$) {
>>> // Need this line because Django also provided jQuery and namespaced as 
>>> django.jQuery
>>> $ = django.jQuery;
>>> }
>>>
>>>
>>>
>>> $(document).ready(function() {
>>>
>>> $("#id_paysPartenaires").change(function()
>>> {
>>>
>>>
>>>
>>>  var 
>>> total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
>>> var SelectNumber =  i
>>>  
>>> SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
>>>  //alert(SelectNumber)
>>>
>>>
>>>
>>> 
>>> $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
>>> 
>>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>>>
>>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>>> 
>>> $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
>>>   }
>>>
>>>
>>> });
>>>
>>>
>>> Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :

 Hi guys,
 I am working on a* Django project,* which involves submission form and
 saving the data in the database using model form.  I am stuck with one of
 the functionalities of form which should work like for example "do you want
 benefit plan: *YES,* *next Field options should pop up*. if click* NO,
 nothing should happen* and move to the next question."

 I went through all over the internet and found the dependent drop-down
 select option but not like field pop up as we click through te form.

 Please let me know how to achieve this in a clear way as I am new to
 Django and programming as well.

 Thank You so much in advance.

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/3f3bf262-7fac-4818-836e-dc8532dae707o%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAPcTzRabB90jUEuYj1v-9JWdOMqqsM4fjN-TEq1CwOcwEPX1zA%40mail.gmail.com
>> 
>> .
>>
>
>
> --
> Mr Shetty Balaji
> Asst. Prof.
> IT Department
> SGGS I&T
> Nanded. My. India
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECSbOt4OiS_WLAucNWQtwpWuZ_LZe1hXyM4%3DFXZzmm6mSVGHw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPcTzRZb4y8yGrf%3DM%3DX4cEhGaf_TWmMnszknWd13Zen_uxfMHw%40mail.gmail.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-10 Thread AMINE AZIZ
👍🏻 
Shre your code, so it will help others. 
And if you can, change to resoulved, so it will be marked in Google search 

Best regards 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0986b7a6-ac98-4687-8d21-1d45917984f6o%40googlegroups.com.


Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-10 Thread Balaji Shetty
Thank You Very Much for considering advice

On Wed, Jun 10, 2020 at 8:11 AM chaitanya orakala 
wrote:

> sure, I will do it by tomorrow
>
>
> On Tue, Jun 9, 2020 at 2:35 AM Balaji Shetty 
> wrote:
>
>> Nice
>>
>> Can you please share sample code on git link.
>>
>> This is very common requirement in every project
>>
>>
>>
>> On Tuesday, June 9, 2020, chaitanya orakala 
>> wrote:
>>
>>> Thank You, Amine Aziz. I tried jquery and it worked. its so simple once
>>> we know jquery.
>>> do help others like you did to me.
>>>
>>> On Sun, Jun 7, 2020 at 1:18 PM AMINE AZIZ  wrote:
>>>
 I will share with you my iwn code used in admin , but it still the same
 as the front end

 withe jQuery i can show input or hide it , so you will do the same with
 popup , by default it will be display none, and with Jquery you can show it
 if user change value to yes dropdown (select)

 you will use id div of pupup to show it or hide it


 if (!$) {
 // Need this line because Django also provided jQuery and namespaced 
 as django.jQuery
 $ = django.jQuery;
 }



 $(document).ready(function() {

 $("#id_paysPartenaires").change(function()
 {



  var 
 total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
 var SelectNumber =  i
  
 SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
  //alert(SelectNumber)



 
 $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
 
 $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();

 $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
 
 $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
   }


 });


 Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :
>
> Hi guys,
> I am working on a* Django project,* which involves submission form
> and saving the data in the database using model form.  I am stuck with one
> of the functionalities of form which should work like for example "do you
> want benefit plan: *YES,* *next Field options should pop up*. if click*
> NO, nothing should happen* and move to the next question."
>
> I went through all over the internet and found the dependent drop-down
> select option but not like field pop up as we click through te form.
>
> Please let me know how to achieve this in a clear way as I am new to
> Django and programming as well.
>
> Thank You so much in advance.
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-users+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-users/3f3bf262-7fac-4818-836e-dc8532dae707o%40googlegroups.com
 
 .

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAPcTzRabB90jUEuYj1v-9JWdOMqqsM4fjN-TEq1CwOcwEPX1zA%40mail.gmail.com
>>> 
>>> .
>>>
>>
>>
>> --
>> Mr Shetty Balaji
>> Asst. Prof.
>> IT Department
>> SGGS I&T
>> Nanded. My. India
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAECSbOt4OiS_WLAucNWQtwpWuZ_LZe1hXyM4%3DFXZzmm6mSVGHw%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> htt

Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-10 Thread chaitanya orakala
Answer :

*First hide the necessary fields which you want  to hide and pop in drop
down.*
style.css

#id_exec_first_name, label[for="id_exec_first_name"] {
  display: none
}

#id_exec_last_name, label[for="id_exec_last_name"]{
display: none
}

#id_exec_title, label[for="id_exec_title"]{
display: none
}

#id_exec_email, label[for="id_exec_email"]{
display: none
}

#id_exec_phone_number, label[for="id_exec_phone_number"]{
display: none
}

#id_exec_fax, label[for="id_exec_fax"]{
display: none
}

#li{
list-style: none;
}



*Include jquery CDN and write a function to make fields display which is
hidden, grad id fields from inspect element.*
*Html*
*
{% extends 'er_form/index.html' %}



{% block content %}


https://code.jquery.com/jquery-3.2.1.slim.min.js";
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous">


$(function () {

 $('#id_executive_authority_1').on('click', function () {
 $('#id_exec_first_name, label[for="id_exec_first_name"]').show();
 $('#id_exec_last_name, label[for="id_exec_last_name"]').show();
 $('#id_exec_title, label[for="id_exec_title"]').show();
 $('#id_exec_email, label[for="id_exec_email"]').show();
 $('#id_exec_phone_number, label[for="id_exec_phone_number"]').show();
 $('#id_exec_fax, label[for="id_exec_fax"]').show();

});
});


$(function () {

 $('#id_executive_authority_0').on('click', function () {
 $('#id_exec_first_name, label[for="id_exec_first_name"]').hide();
 $('#id_exec_last_name, label[for="id_exec_last_name"]').hide();
 $('#id_exec_title, label[for="id_exec_title"]').hide();
 $('#id_exec_email, label[for="id_exec_email"]').hide();
 $('#id_exec_phone_number, label[for="id_exec_phone_number"]').hide();
 $('#id_exec_fax, label[for="id_exec_fax"]').hide();

});
});




 


{% csrf_token %}
{{ client_form.as_p }}
{{ billing_form.as_p }}
Submit


  
{% endblock content %}

>
> *



On Wed, Jun 10, 2020 at 6:00 AM Balaji Shetty 
wrote:

> Thank You Very Much for considering advice
>
> On Wed, Jun 10, 2020 at 8:11 AM chaitanya orakala <
> chaitu.orak...@gmail.com> wrote:
>
>> sure, I will do it by tomorrow
>>
>>
>> On Tue, Jun 9, 2020 at 2:35 AM Balaji Shetty 
>> wrote:
>>
>>> Nice
>>>
>>> Can you please share sample code on git link.
>>>
>>> This is very common requirement in every project
>>>
>>>
>>>
>>> On Tuesday, June 9, 2020, chaitanya orakala 
>>> wrote:
>>>
 Thank You, Amine Aziz. I tried jquery and it worked. its so simple once
 we know jquery.
 do help others like you did to me.

 On Sun, Jun 7, 2020 at 1:18 PM AMINE AZIZ  wrote:

> I will share with you my iwn code used in admin , but it still the
> same as the front end
>
> withe jQuery i can show input or hide it , so you will do the same
> with popup , by default it will be display none, and with Jquery you can
> show it if user change value to yes dropdown (select)
>
> you will use id div of pupup to show it or hide it
>
>
> if (!$) {
> // Need this line because Django also provided jQuery and namespaced 
> as django.jQuery
> $ = django.jQuery;
> }
>
>
>
> $(document).ready(function() {
>
> $("#id_paysPartenaires").change(function()
> {
>
>
>
>  var 
> total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
> var SelectNumber =  i
>  
> SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
>  //alert(SelectNumber)
>
>
>
> 
> $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
> 
> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>
> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
> 
> $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
>   }
>
>
> });
>
>
> Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :
>>
>> Hi guys,
>> I am working on a* Django project,* which involves submission form
>> and saving the data in the database using model form.  I am stuck with 
>> one
>> of the functionalities of form which should work like for example "do you
>> want benefit plan: *YES,* *next Field options should pop up*. if
>> click* NO, nothing should happen* and move to the next question."
>>
>> I went through all over the internet and found the dependent
>> drop-down select option but not like field pop up as we click through te
>> form.
>>
>> Please let me know how to achieve this in a clear way as I am

Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-19 Thread chaitanya orakala
Hi guys,
I made a video on how to solve this problem.
here is the Link

https://youtu.be/XvX6Q64oFyw

On Wed, Jun 10, 2020 at 3:50 PM chaitanya orakala 
wrote:

> Answer :
>
> *First hide the necessary fields which you want  to hide and pop in drop
> down.*
> style.css
> 
> #id_exec_first_name, label[for="id_exec_first_name"] {
>   display: none
> }
>
> #id_exec_last_name, label[for="id_exec_last_name"]{
> display: none
> }
>
> #id_exec_title, label[for="id_exec_title"]{
> display: none
> }
>
> #id_exec_email, label[for="id_exec_email"]{
> display: none
> }
>
> #id_exec_phone_number, label[for="id_exec_phone_number"]{
> display: none
> }
>
> #id_exec_fax, label[for="id_exec_fax"]{
> display: none
> }
>
> #li{
> list-style: none;
> }
> 
>
>
> *Include jquery CDN and write a function to make fields display which is
> hidden, grad id fields from inspect element.*
> *Html*
> *
> {% extends 'er_form/index.html' %}
>
>
>
> {% block content %}
>
>
> https://code.jquery.com/jquery-3.2.1.slim.min.js";
> integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
> crossorigin="anonymous">
>
> 
> $(function () {
>
>  $('#id_executive_authority_1').on('click', function () {
>  $('#id_exec_first_name, label[for="id_exec_first_name"]').show();
>  $('#id_exec_last_name, label[for="id_exec_last_name"]').show();
>  $('#id_exec_title, label[for="id_exec_title"]').show();
>  $('#id_exec_email, label[for="id_exec_email"]').show();
>  $('#id_exec_phone_number, label[for="id_exec_phone_number"]').show();
>  $('#id_exec_fax, label[for="id_exec_fax"]').show();
>
> });
> });
>
>
> $(function () {
>
>  $('#id_executive_authority_0').on('click', function () {
>  $('#id_exec_first_name, label[for="id_exec_first_name"]').hide();
>  $('#id_exec_last_name, label[for="id_exec_last_name"]').hide();
>  $('#id_exec_title, label[for="id_exec_title"]').hide();
>  $('#id_exec_email, label[for="id_exec_email"]').hide();
>  $('#id_exec_phone_number, label[for="id_exec_phone_number"]').hide();
>  $('#id_exec_fax, label[for="id_exec_fax"]').hide();
>
> });
> });
>
>
> 
>
>  
> 
> 
> {% csrf_token %}
> {{ client_form.as_p }}
> {{ billing_form.as_p }}
> Submit
> 
> 
>   
> {% endblock content %}
>
>>
>> *
>
>
>
> On Wed, Jun 10, 2020 at 6:00 AM Balaji Shetty 
> wrote:
>
>> Thank You Very Much for considering advice
>>
>> On Wed, Jun 10, 2020 at 8:11 AM chaitanya orakala <
>> chaitu.orak...@gmail.com> wrote:
>>
>>> sure, I will do it by tomorrow
>>>
>>>
>>> On Tue, Jun 9, 2020 at 2:35 AM Balaji Shetty 
>>> wrote:
>>>
 Nice

 Can you please share sample code on git link.

 This is very common requirement in every project



 On Tuesday, June 9, 2020, chaitanya orakala 
 wrote:

> Thank You, Amine Aziz. I tried jquery and it worked. its so simple
> once we know jquery.
> do help others like you did to me.
>
> On Sun, Jun 7, 2020 at 1:18 PM AMINE AZIZ 
> wrote:
>
>> I will share with you my iwn code used in admin , but it still the
>> same as the front end
>>
>> withe jQuery i can show input or hide it , so you will do the same
>> with popup , by default it will be display none, and with Jquery you can
>> show it if user change value to yes dropdown (select)
>>
>> you will use id div of pupup to show it or hide it
>>
>>
>> if (!$) {
>> // Need this line because Django also provided jQuery and namespaced 
>> as django.jQuery
>> $ = django.jQuery;
>> }
>>
>>
>>
>> $(document).ready(function() {
>>
>> $("#id_paysPartenaires").change(function()
>> {
>>
>>
>>
>>  var 
>> total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
>> var SelectNumber =  i
>>  
>> SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
>>  //alert(SelectNumber)
>>
>>
>>
>> 
>> $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
>> 
>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>>
>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>> 
>> $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
>>   }
>>
>>
>> });
>>
>>
>> Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :
>>>
>>> Hi guys,
>>> I am working on a* Django project,* which involves submission form
>>> and saving the data in the database using model form.  I am stuck with 
>>> one
>>> of the functionalities of form which sh

Re: How to get Dependent Dropdown Feilds in Django ModelForms. Please answer : Important

2020-06-19 Thread chaitanya orakala
Hi guys,
I made a video on how to solve this problem.
Please go to the link below and subscribe for more content.

https://youtu.be/XvX6Q64oFyw

There is a git repo link in the description as well.

Thank You



On Wed, Jun 10, 2020 at 3:50 PM chaitanya orakala 
wrote:

> Answer :
>
> *First hide the necessary fields which you want  to hide and pop in drop
> down.*
> style.css
> 
> #id_exec_first_name, label[for="id_exec_first_name"] {
>   display: none
> }
>
> #id_exec_last_name, label[for="id_exec_last_name"]{
> display: none
> }
>
> #id_exec_title, label[for="id_exec_title"]{
> display: none
> }
>
> #id_exec_email, label[for="id_exec_email"]{
> display: none
> }
>
> #id_exec_phone_number, label[for="id_exec_phone_number"]{
> display: none
> }
>
> #id_exec_fax, label[for="id_exec_fax"]{
> display: none
> }
>
> #li{
> list-style: none;
> }
> 
>
>
> *Include jquery CDN and write a function to make fields display which is
> hidden, grad id fields from inspect element.*
> *Html*
> *
> {% extends 'er_form/index.html' %}
>
>
>
> {% block content %}
>
>
> https://code.jquery.com/jquery-3.2.1.slim.min.js";
> integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
> crossorigin="anonymous">
>
> 
> $(function () {
>
>  $('#id_executive_authority_1').on('click', function () {
>  $('#id_exec_first_name, label[for="id_exec_first_name"]').show();
>  $('#id_exec_last_name, label[for="id_exec_last_name"]').show();
>  $('#id_exec_title, label[for="id_exec_title"]').show();
>  $('#id_exec_email, label[for="id_exec_email"]').show();
>  $('#id_exec_phone_number, label[for="id_exec_phone_number"]').show();
>  $('#id_exec_fax, label[for="id_exec_fax"]').show();
>
> });
> });
>
>
> $(function () {
>
>  $('#id_executive_authority_0').on('click', function () {
>  $('#id_exec_first_name, label[for="id_exec_first_name"]').hide();
>  $('#id_exec_last_name, label[for="id_exec_last_name"]').hide();
>  $('#id_exec_title, label[for="id_exec_title"]').hide();
>  $('#id_exec_email, label[for="id_exec_email"]').hide();
>  $('#id_exec_phone_number, label[for="id_exec_phone_number"]').hide();
>  $('#id_exec_fax, label[for="id_exec_fax"]').hide();
>
> });
> });
>
>
> 
>
>  
> 
> 
> {% csrf_token %}
> {{ client_form.as_p }}
> {{ billing_form.as_p }}
> Submit
> 
> 
>   
> {% endblock content %}
>
>>
>> *
>
>
>
> On Wed, Jun 10, 2020 at 6:00 AM Balaji Shetty 
> wrote:
>
>> Thank You Very Much for considering advice
>>
>> On Wed, Jun 10, 2020 at 8:11 AM chaitanya orakala <
>> chaitu.orak...@gmail.com> wrote:
>>
>>> sure, I will do it by tomorrow
>>>
>>>
>>> On Tue, Jun 9, 2020 at 2:35 AM Balaji Shetty 
>>> wrote:
>>>
 Nice

 Can you please share sample code on git link.

 This is very common requirement in every project



 On Tuesday, June 9, 2020, chaitanya orakala 
 wrote:

> Thank You, Amine Aziz. I tried jquery and it worked. its so simple
> once we know jquery.
> do help others like you did to me.
>
> On Sun, Jun 7, 2020 at 1:18 PM AMINE AZIZ 
> wrote:
>
>> I will share with you my iwn code used in admin , but it still the
>> same as the front end
>>
>> withe jQuery i can show input or hide it , so you will do the same
>> with popup , by default it will be display none, and with Jquery you can
>> show it if user change value to yes dropdown (select)
>>
>> you will use id div of pupup to show it or hide it
>>
>>
>> if (!$) {
>> // Need this line because Django also provided jQuery and namespaced 
>> as django.jQuery
>> $ = django.jQuery;
>> }
>>
>>
>>
>> $(document).ready(function() {
>>
>> $("#id_paysPartenaires").change(function()
>> {
>>
>>
>>
>>  var 
>> total_partenaire=$("#id_multipartenairecooperationbilaterale_set-TOTAL_FORMS").val()
>> var SelectNumber =  i
>>  
>> SelectedValuePartenaire=$("#id_multipartenairecooperationbilaterale_set-"+SelectNumber+"-multiPartenairePP").val()
>>  //alert(SelectNumber)
>>
>>
>>
>> 
>> $("[id=div-2-multiAdefinir]:eq("+SelectNumber+")").hide();
>> 
>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>>
>> $("[id=div-2-multiGouvernementPP]:eq("+SelectNumber+")").hide();
>> 
>> $("[id=div-2-multiPaysPP]:eq("+SelectNumber+")").show();
>>   }
>>
>>
>> });
>>
>>
>> Le dimanche 7 juin 2020 07:34:00 UTC+1, Sai a écrit :
>>>
>>> Hi guys,
>>> I am working on a* Django project,* which involves submission form
>>> and saving the data i