# this imports db package from google.appengine.ext
from google_appengine.google.ext import db


# this makes an instance 
class Story(db.Model):
      title = db.StringProperty()
      body = db.TextProperty()
      lines = db.integerproperty()
      year = db.DateTimeProperty
      created = db.DateTimeProperty(auto_now_add=True)


# this creates one entity of database story
story = Story(title='My title')
story.body = 'My body'
story.lines=100
story.year=1990
story.put()


story = Story(title='My title1')          # creates second entity of datastore
story.body = 'this is my first story'
story.lines=150
story.year=1995
story.put()


story = Story(title='My title2')    	 # creates third entity of datastore
story.body = 'this is my second story'
story.lines=50
story.year=2000
story.put()


story = Story(title='My title3')
story.body = 'this is my third story'   # creates fourth entity of datastore
story.lines=200
story.year=2005
story.put()


story = Story(title='My title4')
story.body = 'this is my fourth story'   # creates fifth entity of datastore
story.lines=250
story.year=2011
story.put()

stories = Story.all().filter('date >=', yesterday).order('-date')
for story in stories:
	print story.title



