octabytes / FireO

Google Cloud Firestore modern and simplest convenient ORM package in Python. FireO is specifically designed for the Google's Firestore
https://fireo.octabyte.io
Apache License 2.0
247 stars 29 forks source link

Best way to get an instance id on TypedModels, without saving first #223

Open milanmitrovic opened 6 months ago

milanmitrovic commented 6 months ago

As in the title, I have a TypedModel and want to access the id field. The field gets populated after I save, but I would like to avoid one extra write just to get an id. I saw in the docs that for regular Model instances the id field is populated on creation, and you don't need to save the data to get an id. I would like to have the same functionality on TypedModels, but I don't know what is the simplest way to do that.

Can you help me out?