Skip to content

Conversation

@jeremystretch
Copy link
Member

Fixes: #15087

  • Introduces support for specifying a subset of serializer fields to be returned in a REST API request (e.g. GET /api/dcim/sites/?fields=id,name,status,region)
  • Introduces the get_prefetches_for_serializer() utility function
  • Extends the base API viewset to automatically resolve the necessary queryset prefetches for a serializer based on the requested fields
  • Removes all now-unnecessary explicit calls to prefetch_related() on API views (a few remain for various reasons)
  • Removes the brief_prefetch_fields property from API views

@jeremystretch jeremystretch added this to the v4.0 milestone Feb 12, 2024
@jeremystretch
Copy link
Member Author

The test failure is due to a bug in the nested serializer for FHRP group assignments. (It should be returning group rather than group_id.)

@jeremystretch

This comment was marked as resolved.

…nder brief mode (#15134)

* Fixes #15133: Fix FHRP group representation on assignments endpoint under brief mode

* Update API test
@jeremystretch jeremystretch marked this pull request as ready for review February 13, 2024 17:14
@jeremystretch jeremystretch merged commit b3f25a4 into feature Feb 14, 2024
@jeremystretch jeremystretch deleted the 15087-dynamic-serializers branch February 14, 2024 14:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants