Try use db.Expando instead of db.Model, that'll all you to add fields
without defining them first.

On Mar 4, 9:45 pm, li jinyu <disorder...@gmail.com> wrote:
> 2009/3/4 Doug <doug...@gmail.com>
>
>
>
> > I am also pretty green with GAE, but I think that the db Model Event
> > and the db model event are 2 different db models.
>
> > If they are 2 different models this would be why you are always
> > getting none when you read from it.  You would be able to see if you
> > have 2 in the console.
>
> OK, I'll check that. Thanks.
>
>
>
> > BTW - What is "None"?  I do not see that as a db Model option in the
> > Google doc.  It looks to me like you would want those to be strings.
>
> In fact, I don't want to create columns for color and status, so I use None
>
>
>
>
>
> > Doug
>
> > On Mar 3, 10:32 pm, disorderdev <disorder...@gmail.com> wrote:
> > > Hi, I'm a newbie here, both python and app engine. a few questions:
> > >  I store some fields in DB, but when show message on Web, I need more
> > > fields, most of them are calculated according to fields in DB, For now
> > > I don't want to do the calculating on web, but when I add some fields
> > > to the DB model class, the web dose not recognize them, all values are
> > > None, what should I do?
>
> > > For example, I have a class
> > > class Event(db.Model) :
> > >         owner = db.UserProperty()
> > >         title = db.StringProperty()
> > >         content = db.StringProperty(multiline = True)
> > >         status = None
> > >         color = None
>
> > > when showing events on web, I want 'color' and 'status', so after
> > > retrieve the data from DB, I do the following:
>
> > >                 for event in events :
> > >                         logger.info(event.status)
> > >                         logger.info(event.color);
> > >                         event.create_time = datetime.now()
> > >                         event.status = "Finished"
> > >                         event.color = "green"
>
> > > but on web, they are still None.
>
> > > BTW: I have to add status and color in class, or these fields are not
> > > recognized.
>
> --
> Don't schedule every day, make them disorder.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to