@@ -149,7 +149,7 @@ class Grant(models.Model):
149149 * :attr:`scope` Required scopes, optional
150150 """
151151 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
153153 application = models .ForeignKey (oauth2_settings .APPLICATION_MODEL )
154154 expires = models .DateTimeField ()
155155 redirect_uri = models .CharField (max_length = 255 )
@@ -186,7 +186,7 @@ class AccessToken(models.Model):
186186 * :attr:`scope` Allowed scopes
187187 """
188188 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 )
190190 application = models .ForeignKey (oauth2_settings .APPLICATION_MODEL )
191191 expires = models .DateTimeField ()
192192 scope = models .TextField (blank = True )
@@ -255,7 +255,7 @@ class RefreshToken(models.Model):
255255 bounded to
256256 """
257257 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 )
259259 application = models .ForeignKey (oauth2_settings .APPLICATION_MODEL )
260260 access_token = models .OneToOneField (AccessToken ,
261261 related_name = 'refresh_token' )
0 commit comments