This repository was archived by the owner on May 26, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
rest_framework_jwt/refreshtoken Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ from __future__ import unicode_literals
3
+
4
+ from django .db import models , migrations
5
+
6
+
7
+ class Migration (migrations .Migration ):
8
+
9
+ dependencies = [
10
+ ('refreshtoken' , '0001_initial' ),
11
+ ]
12
+
13
+ operations = [
14
+ migrations .AlterField (
15
+ model_name = 'refreshtoken' ,
16
+ name = 'app' ,
17
+ field = models .CharField (max_length = 255 ),
18
+ ),
19
+ migrations .AlterUniqueTogether (
20
+ name = 'refreshtoken' ,
21
+ unique_together = set ([('user' , 'app' )]),
22
+ ),
23
+ ]
Original file line number Diff line number Diff line change @@ -25,9 +25,12 @@ class RefreshToken(models.Model):
25
25
"""
26
26
key = models .CharField (max_length = 40 , primary_key = True )
27
27
user = models .ForeignKey (AUTH_USER_MODEL , related_name = 'refresh_tokens' )
28
- app = models .CharField (max_length = 255 , unique = True )
28
+ app = models .CharField (max_length = 255 )
29
29
created = models .DateTimeField (auto_now_add = True )
30
30
31
+ class Meta :
32
+ unique_together = ('user' , 'app' )
33
+
31
34
def save (self , * args , ** kwargs ):
32
35
if not self .key :
33
36
self .key = self .generate_key ()
You can’t perform that action at this time.
0 commit comments