File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ Contributors
1010Abhishek Patel
1111Alessandro De Angelis
1212Alan Crosswell
13+ Anvesh Agarwal
1314Asif Saif Uddin
1415Ash Christopher
1516Aristóbulo Meneses
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414### Security
1515 -->
1616
17+ ## [ unreleased]
18+
19+ ### added
20+ * added ` select_related ` in intospect view for better query performance
21+
22+
1723## [ 1.3.2] 2020-03-24
1824
1925### Fixed
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ class IntrospectTokenView(ClientProtectedScopedResourceView):
2424 @staticmethod
2525 def get_token_response (token_value = None ):
2626 try :
27- token = get_access_token_model ().objects .get (token = token_value )
27+ token = get_access_token_model ().objects .select_related (
28+ "user" , "application"
29+ ).get (token = token_value )
2830 except ObjectDoesNotExist :
2931 return HttpResponse (
3032 content = json .dumps ({"active" : False }),
Original file line number Diff line number Diff line change @@ -321,3 +321,7 @@ def test_view_post_invalid_client_creds_plaintext(self):
321321 "client_id" : self .application .client_id ,
322322 "client_secret" : self .application .client_secret + "_so_wrong" })
323323 self .assertEqual (response .status_code , 403 )
324+
325+ def test_select_related_in_view_for_less_db_queries (self ):
326+ with self .assertNumQueries (1 ):
327+ self .client .post (reverse ("oauth2_provider:introspect" ))
You can’t perform that action at this time.
0 commit comments