@@ -149,7 +149,7 @@ class Grant(models.Model):
149
149
* :attr:`scope` Required scopes, optional
150
150
"""
151
151
user = models .ForeignKey (settings .AUTH_USER_MODEL )
152
- code = models .CharField (max_length = 255 , db_index = True ) # code comes from oauthlib
152
+ code = models .CharField (max_length = 255 , unique = True ) # code comes from oauthlib
153
153
application = models .ForeignKey (oauth2_settings .APPLICATION_MODEL )
154
154
expires = models .DateTimeField ()
155
155
redirect_uri = models .CharField (max_length = 255 )
@@ -186,7 +186,7 @@ class AccessToken(models.Model):
186
186
* :attr:`scope` Allowed scopes
187
187
"""
188
188
user = models .ForeignKey (settings .AUTH_USER_MODEL , blank = True , null = True )
189
- token = models .CharField (max_length = 255 , db_index = True )
189
+ token = models .CharField (max_length = 255 , unique = True )
190
190
application = models .ForeignKey (oauth2_settings .APPLICATION_MODEL )
191
191
expires = models .DateTimeField ()
192
192
scope = models .TextField (blank = True )
@@ -255,7 +255,7 @@ class RefreshToken(models.Model):
255
255
bounded to
256
256
"""
257
257
user = models .ForeignKey (settings .AUTH_USER_MODEL )
258
- token = models .CharField (max_length = 255 , db_index = True )
258
+ token = models .CharField (max_length = 255 , unique = True )
259
259
application = models .ForeignKey (oauth2_settings .APPLICATION_MODEL )
260
260
access_token = models .OneToOneField (AccessToken ,
261
261
related_name = 'refresh_token' )
0 commit comments