Return to Snippet

Revision: 9566
at November 12, 2008 14:09 by tamuratetsuya


Updated Code
# 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

Revision: 9565
at November 12, 2008 13:59 by tamuratetsuya


Initial Code
# 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
   songs=Song.all()
    for song in songs:
      print song.title
      print song.author
      print song.publish_date
      print "<br><br>"

Initial URL

                                

Initial Description

                                

Initial Title
python expando db Django GAE

Initial Tags
python, django

Initial Language
Python