Hello everyone i have quick question with something i am having trouble with. i have these two model which use foreign keys. but i want one of the foreign keys options to change depending on what you selected in the previous fk.
i also posted this on stack overflow here is the link: https://stackoverflow.com/questions/72465024/foreign-key-change-depending-on-previous-selection-django Here is the code for my models. class Customer(models.Model): company_name = models.CharField(max_length=255) contact_person = models.CharField(max_length=255) email = models.EmailField() phone = models.IntegerField() .............. Connections(models.Model): company = models.ForeignKey(Customer, on_delete=models.CASCADE) customerVlan = models.ForeignKey(CustomerVlan, on_delete=models.CASCADE) switch_port_number = models.IntegerField(default=0) duplex = models.CharField(choices=duplex, max_length=200) ............ class WorkOrder(models.Model): work_order_date = models.DateTimeField( default=timezone.now) request_date = models.DateField(default=timezone.now) company_id = models.ForeignKey(Customer, on_delete=models.CASCADE) connections= models.ForeignKey(Connections, on_delete=models.CASCADE, blank= True, null=True) .. .......... [image: Screenshot 2022-06-01 120740.png] as you can see in the image when i select a company_id i want only connections with that company to show up and not everything in the database because there are allot of connections. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/180e6323-c244-45fe-872a-ea9ad93c0b0an%40googlegroups.com.

