17 lines
468 B
Python
17 lines
468 B
Python
import pickle
|
|
from .models import Organization
|
|
|
|
def to_pickle(data):
|
|
return pickle.dumps(data).hex()
|
|
|
|
def from_pickle(data):
|
|
return pickle.loads(bytes.fromhex(data))
|
|
|
|
# remove duplicate users
|
|
# https://stackoverflow.com/questions/9427163/remove-duplicate-dict-in-list-in-python
|
|
def remove_dup_dict_in_list(l):
|
|
return [i for n, i in enumerate(l) if i not in l[n + 1:]]
|
|
|
|
def get_org_by_id(org_id):
|
|
return Organization.objects.filter(id__exact=org_id)[0]
|