1
0
Fork 0
IdreXyz/label/tools.py
2017-08-17 16:44:26 +02:00

20 lines
429 B
Python

def get_catalog_tag_from_id(ident):
return 'IDRE{:0>3d}'.format(ident)
def get_id_from_catalog_tag(tag):
try:
return int(tag[4:])
except ValueError:
return -1
def get_contribs(contributors):
contrib_list = []
for contrib in contributors:
contrib_list.append({
'slug': contrib.slug,
'name': contrib.name
})
return contrib_list