Is it possible to set dynamic default value?

Feature(s) impacted

Id should be generated each time

Observed behavior

Id is assigned based on the first run, then remains the same

Expected behavior

I’d like to have different id for each item created. Is there any solution for this?

Hello @Michael :wave:

Welcome to the community.

The field you’re creating here is a Smart Field. Its value is not persisted to the database but calculated on each request and usually depends on the other fields. It is not possible to keep the value calculated on the first request for the subsequent requests.

What you can do is create a regular database field of type UUID and give it a default value. DataTypes.UUIDV4 should work as a default value.

Let me know if you need help with that.