It can be done in Python version by using eval statement or
type()/classobj() function:
from google.appengine.ext import db
property = {'string': db.StringProperty, 'rating': db.RatingProperty}
Book = type('Book', (db.Model,), {'title': property['string'](),
'author': property['string'](), 'rating': property['rating']()})
new_book = Book(title='Harry James Potter', author='Joanne Kathleen
Rowling', rating=100)
new_book.put()
book = Book.all().filter('title =', 'Harry James Potter').get()
print book.title
print book.author
print book.rating
result:
Harry James Potter
Joanne Kathleen Rowling
100
2009/11/16 fhucho <[email protected]>:
> Hi,
> I am developing a web app, where users should be able to (in this
> order):
> 1) create their item type (item type can be everything - car,
> book, movie..., item type has some user defined parameters,
> like price, rating)
> 2) add items of their type - e.g. they can create book type (with
> title, author, rating parameters) and then add books
> 3) view, filter (at least by one parameter), delete, edit their
> items
>
> How should I design the data model? Is this even posible in App
> Engine?
>
> Thanks in advance
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=.