Describe the bug
N+1 problem occurs on calling endpoints that uses the api key as permission class.
To Reproduce
Steps to reproduce the behavior:
- Create a class inherited BaseHasAPIKey
- Set the permission_classes of a APIView to class created instep 1.
- Call the endpoint
- If you have profiling, or sentry enabled in project you can see the N+1 issue occurred.
Expected behavior
At most one select and one update query supposed to be executed.
Screenshots

Server:
- OS: Linux
- Python Version: [e.g. 3.13]
- Django Version: [e.g. 5.2.1]
- DRF Version: 3.16.0
- djangorestframework-api-key: 3.1.0