Make a Unique Tracking Number in Python Django

Make a Unique Tracking Number in Python Django

#make unique support number
Tracking_number = make_unique_support_number('12', 10)
def make_unique_support_number(id,n):

    padding=int(n)-int(len(str(id)))

    s=''

    for x in range (0, padding):

        s=s+str('0')

    return "ST-"+str(s)+str(id)

How To Create a Unique Number Containing text with fixed digits Number Like AB000012?

How To Create a Unique Number Containing text with fixed digits Number Like AB000012?

 

# For 10 digits String
 $num = sprintf('%010d', 12); 
 example: 0000000012


# For 8 digits String
 $num = sprintf('%08d', 12); 
 example: 00000012


# For Create Text base Number
 $str = "AB".$num;
 example = "AB0000000012" or "AB00000012"



OR

$unique_num = 'AB'.sprintf('%08d', 12);
example = "AB0000000012"