mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 20:10:10 +03:00
Merge cb4562b9bd
into 822eb39599
This commit is contained in:
commit
6d77e5e42f
|
@ -34,6 +34,9 @@ class Token(models.Model):
|
|||
return super(Token, self).save(*args, **kwargs)
|
||||
|
||||
def generate_key(self):
|
||||
if hasattr(settings, 'SECRET_KEY') and len(settings.SECRET_KEY):
|
||||
return sha1('%s%s' % (settings.SECRET_KEY, binascii.hexlify(os.urandom(20)))).hexdigest()
|
||||
|
||||
return binascii.hexlify(os.urandom(20))
|
||||
|
||||
def __unicode__(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user