On Feb 1, 4:37 pm, BearXu <bearx...@gmail.com> wrote:
> some questions can not be answerd by the comparion with Django in the
> web2py.com:
>
> 1)How many field types does DAL have now?

string length=32 IS LENGTH(length)
blob
boolean
integer IS INT IN RANGE(1e100,1e100)
double IS FLOAT IN RANGE(1e100,1e100)
date IS DATE()
time IS TIME()
datetime IS DATETIME()
password
upload
reference


Can we extend by ouselves?

if you subclass a driver you could add your own, but this is very
uncommon


>
> 2)In Django, when they defining a model:
>
> class Blog(models.Model):------------>a table in DAL
>     name = models.CharField(max_length=100)--------------->a SQLFIELD in DAL
>     def save(self, force_insert=False,
> force_update=False):------------------------>Can we do this in DAL?
>         do_something()
>         super(Blog, self).save(force_insert, force_update) # Call the
> "real" save() method.
>         do_something_else()

try using the SQLFORM(onvalidate=lambda...,onaccept=lambda...)
callbacks to insert this behavior.

>
> 3)In Django table can be inherited like:
>
> class *Place*(models.Model):
>     name = models.CharField(max_length=50)
> class Restaurant(*Place*):---------------------> Can it be done in DAL?
>     serves_hot_dogs = models.BooleanField()
>     serves_pizza = models.BooleanField()
>
> I found that DAL can do a lot more than documented, so add these
> information in it will be more userful.

web2py has a way to do table inheritance.

Maybe like this:
db.define_table('posts',db.Field('title'))
db.define_table('blog_posts',db.posts)

I have not tried it yet or tested it on GAE, maybe somebody else who
knows can correct me.

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

Reply via email to