[Django]-Django limit_choices_to for multiple fields with "or" condition

33👍

You can use Q objects to achieve this.

from django.db.models import Q


limit_choices_to=Q(share_holder=True) | Q(distributor=True)

Official docs on ForeignKey.limit_choices_to

Leave a comment