Geoffrey-Django/GeoffreyApp/util.py

22 lines
349 B
Python
Raw Normal View History

import string
import random
def create_token(length=25):
token = ''
for i in range(0, length):
d = random.choice(string.digits + string.ascii_lowercase)
token += d
return token
def objects_list_to_json(obj_list):
json_list = []
for obj in obj_list:
json_list.append(obj.json)
return json_list