1
0
Fork 0
IdreXyz/label/tools.py

20 lines
429 B
Python
Raw Normal View History

2016-02-01 18:42:01 +01:00
def get_catalog_tag_from_id(ident):
2015-03-14 22:38:12 +01:00
return "IDRE{:0>3d}".format(ident)
def get_id_from_catalog_tag(tag):
try:
return int(tag[4:])
except ValueError:
return -1
2015-03-14 22:38:12 +01:00
def get_contribs(contributors):
contrib_list = []
for contrib in contributors:
contrib_list.append({
2015-05-02 14:53:57 +02:00
"slug": contrib.slug,
2015-03-14 22:38:12 +01:00
"name": contrib.name
})
return contrib_list