1234567891011121314151617 |
- from photo.models import UUIDInfo
- import shortuuid
- def curtailUUID(length=10):
- flag = True
- while flag:
- uuid = shortuuid.uuid()[-length:]
- try:
- UUIDInfo.objects.get(uuid=uuid)
- except UUIDInfo.DoesNotExist:
- flag = False
- return uuid
|