Re: How to limit ForeignKey field to another model FK depending on value

2016-02-02 Thread Ahmad Zoughbi
Just for reference: i could get it to work by passing limit_choices_to to the "province" in Project model. class Project(models.Model): project_name = models.CharField(max_length=100) province = models.ForeignKey(Province, limit_choices_to={"country": 1}) -- You received this message

Re: How to limit ForeignKey field to another model FK depending on value

2016-02-02 Thread Ahmad Zoughbi
Thanks James. But i think this solution will apply also on both models (WorkArea and Project) right? while i want to get it to work only on the field province of model *Project . * On Tuesday, February 2, 2016 at 12:22:20 AM UTC+2, James Schneider wrote: > > The question: In the model Project h

Re: How to limit ForeignKey field to another model FK depending on value

2016-02-01 Thread James Schneider
> > The question: In the model Project how do i show only provinces from > Province model, that has country set to X (If i have countries "USA" and > "Canada" i want the field province to show list of provinces in "USA" > only/preselecting country). > > You would filter the choices available to the