Groups
Groups
Sign in
Groups
Groups
Django users
Conversations
About
Send feedback
Help
filtering queryset in CreateAPIView view
18 views
Skip to first unread message
Larry Martell
unread,
Dec 28, 2022, 11:32:25 AM
12/28/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
I have a CreateAPIView view with this code in the serializer:
class AssignWorkItemSerializer(serializers.Serializer, WorkitemSerializerMixin):
assigneeIds = serializers.ListSerializer(
child=serializers.PrimaryKeyRelatedField(
queryset=get_user_model().objects.filter(userrole__role__name='analyst')
),
source='assignees'
)
This is failing because that query returns multiple rows. I want to
filter that queryset at run time by something that is available to me
in the request. Is there a way to do that?
Reply all
Reply to author
Forward
0 new messages