Hi, The field 'continent' in Location model is redundant, should not be there.
class Location(models.Model): continent = models.ForeignKey(Continent,on_delete=models.CASCADE) country = models.ForeignKey(Country,on_delete=models.CASCADE) city = models.CharField(max_length=50) street = models.CharField(max_length=100) On Wed, May 22, 2019 at 11:22 AM Balaji Shetty <balajishe...@gmail.com> wrote: > Hi > > I have registered model in admin.py > Added Continent ( Cont1, Cont2, Cont3 ) > > Added Country under Continent > > Cont1 - Count11 > Cont1- Count12 > > Cont2 - Count21 > Cont2-Count22 > > Con3-Count31 > Con3-Count31 > > When I add Location > > When i select Cont1, I should get only Count11 , Count12 > > When i select Cont2, I should get only Count21 , Count22 > > When i select Cont3, I should get only Count31 , Count32 > > But I get all Countries under all Continent. Cascading dependency are not > shown > > I tried different option but lot of issues are there . > > > > Example > > > > On Wed, May 22, 2019 at 10:56 AM Nitin Kumar <nitinkumar...@gmail.com> > wrote: > >> Everything seems alright. It seems you haven't created any continents >> yet. The table is empty. >> >> On Wed, 22 May, 2019, 10:52 AM Balaji Shetty <balajishe...@gmail.com >> wrote: >> >>> Hi >>> >>> I am learning Django from last months and want to implement Cascading >>> Drop Down for Continent and Country in Admin GUI. >>> >>> I dropped same query two times but i could not get exact correct >>> solution. >>> >>> I tried lot of option like >>> django-smart-select and many more.. >>> >>> But i could not get updates in drop down. >>> >>> Can Any Django Expert solve this issue? Your help would be highly >>> appreciated. >>> >>> This is sample Model for demonstration of the schema >>> models.py >>> ---------------------------------------------------------- >>> >>> >>> class Continent(models.Model): >>> name = models.CharField(max_length=255) >>> >>> def __str__(self): >>> return self.name >>> >>> >>> class Country(models.Model): >>> continent = models.ForeignKey(Continent,on_delete=models.CASCADE) >>> name = models.CharField(max_length=255) >>> >>> def __str__(self): >>> return self.name >>> >>> class Location(models.Model): >>> continent = models.ForeignKey(Continent,on_delete=models.CASCADE) >>> country = models.ForeignKey(Country,on_delete=models.CASCADE) >>> city = models.CharField(max_length=50) >>> street = models.CharField(max_length=100) >>> >>> def __str__(self): >>> return self.city >>> >>> >>> >>> >>> -- >>> >>> >>> *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information >>> Technology,* >>> *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India* >>> *Official: bsshe...@sggs.ac.in <bsshe...@sggs.ac.in> * >>> * Mobile: +91-9270696267* >>> >>> -- >>> 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 post to this group, send email to django-users@googlegroups.com. >>> Visit this group at https://groups.google.com/group/django-users. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/CAECSbOtoje0sdMsoeQvCO-mq-h-AQVOKtnYA3wFnLAE-tPhXGg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/django-users/CAECSbOtoje0sdMsoeQvCO-mq-h-AQVOKtnYA3wFnLAE-tPhXGg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- >> 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 post to this group, send email to django-users@googlegroups.com. >> Visit this group at https://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CAKzNicGqspLgrFnYf%3D%2B22s8SJUc2uVTt5223UJ7Ba1d6ZbtqbA%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CAKzNicGqspLgrFnYf%3D%2B22s8SJUc2uVTt5223UJ7Ba1d6ZbtqbA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > > > *Mr. Shetty Balaji S.Asst. ProfessorDepartment of Information Technology,* > *SGGS Institute of Engineering & Technology, Vishnupuri, Nanded.MH.India* > *Official: bsshe...@sggs.ac.in <bsshe...@sggs.ac.in> * > * Mobile: +91-9270696267* > > -- > 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 post to this group, send email to django-users@googlegroups.com. > Visit this group at https://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAECSbOsdkJZ%3DPT7vxyt1K5c2%3D-%2B9_squ5SES0zK_vD5Dyo97Bg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAECSbOsdkJZ%3DPT7vxyt1K5c2%3D-%2B9_squ5SES0zK_vD5Dyo97Bg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKzNicHQ8yR2MRxAgm_%2BnpvVDxE4b9YB9HQcC3nGZw_ikPeavA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.