Posted By

tamuratetsuya on 11/12/08


Tagged

db python expando django GAE


Versions (?)

python expando db Django GAE


 / Published in: Python
 

  1. # sample Expando data in models.py
  2. class Song(db.Expando):
  3. title = db.StringProperty()
  4.  
  5.  
  6. # sample Expando data in views.py
  7. crazy = Song(title='Crazy like a diamond',
  8. author='Lucy Sky',
  9. publish_date='yesterday',
  10. rating=5.0)
  11. hoboken = Song(title='The man from Hoboken',
  12. author=['Anthony', 'Lou'],
  13. publish_date=datetime.datetime(1977, 5, 3))
  14. crazy.last_minute_note=db.Text('Get a train to the station.')
  15.  
  16. crazy.put()
  17. hoboken.put()
  18.  
  19. #html output in views.py
  20. songs=Song.all()
  21. for song in songs:
  22. print song.title
  23. print song.author
  24. print song.publish_date

Report this snippet  

You need to login to post a comment.