/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# sample Expando data in models.py class Song(db.Expando): title = db.StringProperty() # sample Expando data in views.py crazy = Song(title='Crazy like a diamond', author='Lucy Sky', publish_date='yesterday', rating=5.0) hoboken = Song(title='The man from Hoboken', author=['Anthony', 'Lou'], publish_date=datetime.datetime(1977, 5, 3)) crazy.last_minute_note=db.Text('Get a train to the station.') crazy.put() hoboken.put() #html output in views.py songs=Song.all() for song in songs: print song.title print song.author print song.publish_date