2

My question is same as Django: limit_choices_to (Is this correct)

class Customer(models.Model):
    account = models.ForeignKey(Account)


class Order(models.Model):
    account = models.ForeignKey(Account)
    customer = models.ForeignKey(Customer, limit_choices_to={'account': 'self.account'})

So, how to use the self here? Is it really impossible to use limit_choices_to dynamically to limit based on the value of another field in the current model?

0 Answers0