(django1.6.5)
In [5]: from django.utils.crypto import get_random_string In [6]: get_random_string() Out[6]: u'JgkKgwrOcdZD' In [7]: get_random_string(20) Out[7]: u'7iLVOOyJKSoBNjgM3tNK' In [8]: get_random_string(22) Out[8]: u'vJV5VmxoedRFYi5XUriIp8'
参考サイト