Search code examples
pythongoogle-app-enginegoogle-cloud-datastoreapp-engine-ndbwebapp2

Google App Engine: Create a 'Save as draft' feature for an entity


I would like to create a 'save as draft' feature for a long entity form.

Consider the data structure example below:

class BigEntity(ndb.Model):
    title = ndb.StringProperty()
    date = ndb.DateTimeProperty()
    # Many more properties ...

The form.html:

<form method="post">
    Title: <input type="text" name="title">
    <!-- Very long form -->
    Submit <input type="submit" value="Submit">
    Save As Draft <input type="submit" value="Save As Draft">
</form>

What is a solid way to build a 'save as draft' feature for this?


Solution

  • You can simply add a property isDraft to your entity and set it to true or false depending on which button was pressed.