There is a save() method that saves an instance, if a get() method that returns values, and is there a method to save and return saved values?

If there is no such method, how can I save the values ​​and then get them right away? The table contains the only uniquely id field, which is filled with an increment; you cannot get() from it get() because we don’t know with which id we saved save() .

    1 answer 1

    The save () method saves an object and then you can work with this object.

     >>> b2 = Blog(name='Cheddar Talk', tagline='Thoughts on cheese.') >>> b2.id # Returns None, because b doesn't have an ID yet. >>> b2.save() >>> b2.id # Returns the ID of your new object. 

    A source

    • Oh, thanks, what you need. - trec