python - Flask - Trying to add an ID field in database which is incremented each time -
this code models.py file. working until tried add new field "id" gets incremented each item. flask app running on google app engine.
from google.appengine.ext import db class post(db.model): id = db.column(db.integer, primary_key=true) title = db.stringproperty(required = true) content = db.textproperty(required = true)
this traceback get:
<type 'exceptions.attributeerror'>: 'module' object has no attribute 'column' traceback (most recent call last): file "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/main.py", line 2, in <module> blog import app file "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/__init__.py", line 7, in <module> import views file "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/views.py", line 2, in <module> models import post file "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/models.py", line 3, in <module> class post(db.model): file "/base/data/home/apps/s~smart-cove-95709/1.384688470778541604/blog/models.py", line 4, in post id = db.column(db.integer, primary_key=true)
i tried without success:
class post(db.model): id = db.integer(primary_key=true) title = db.stringproperty(required = true) content = db.textproperty(required = true)
column
not member sine you're not using sqlalchemy.
i think model google.appengine.ext.db has key out of box, refer google documentation
Comments
Post a Comment