I have the same problem and I reached this topic. I had a problem with these identifiers because I used them to identify such objects in HTML, for example:
<li id={{ entity.id }}>{{ entity.value }}</li>
and I had duplicate identifiers on the DOM, but you answered me: it is likely that the data store will not repeat identifiers within the same parent group, as said in this part of the documentation :
"In other words, the object must have an identifier that is unique to all objects of the same type and with the same parent of the group of objects (if any),"
so I will generate an identifier based on the parent key-name (maybe an ID) and use this lazy number to identify the object in the DOM.
python:
entity_rs = Entity.all() entities = [] for entity in entity_rs: entity.id = '%s-%s' % (entity.parent().key().id_or_name(), entity.key().id_or_name()) entities.append(entity):
HTML:
<ul> {% for entity in entities %} <li id="{{ entity.id }}">{{ entity.value }}</li> {% endfor %} </ul>
I know this is not beautiful, but (under certain conditions) it works.
fiatjaf
source share