Populating django m2m field with another model's id
I'm trying to add a new m2m field in my model's serializer but i want the ids to be from another model.
voting_members = serializers.PrimaryKeyRelatedField(queryset=Person.objects.all(), many=True)
However this throws an assertion error:
The field 'voting_member' was declared on serializer NccnPanelSerializer, but has not been included in the 'fields' option.
Is there a way to assign another model's ids to a different model serializer's field?