Yes, Sir! Thanks 2009/2/2 mdipierro <[email protected]>
> > > > Can we extend by ouselves? > > if you subclass a driver you could add your own, but this is very > uncommon > > I say do not do this because it may break web2py. > > There are three level: > - how data is stored in a field > - what kind of data should be in a field > - how the data is represented to the user > > Django mixes them up and has different types of fields for different > types of data. Hence occasionally you need to define new fields. > > Web2py keeps them separate: > - how data is stored in a field -> DAP maps into database types > (string, text, integer, etc.) > - what kind of data should be in a field -> This belongs exclusively > to validators > - how the data is represented to the user -> db.table.field.widget > (for input) and db.table.field.represent (for output) > > I consider this a strength of web2py. Less magic and easier to extend. > > If you have a new type (say latitude) you would not make a new field > type. You would make a new validator and perhaps a new widget object. > > Massimo > > On Feb 2, 1:49 am, Fran <[email protected]> wrote: > > On Feb 1, 11:17 pm, Robin B <[email protected]> wrote: > > > > > On Feb 1, 4:37 pm, BearXu <[email protected]> wrote: > > > > 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() > > > web2py has a way to do table inheritance. > > > > For this simple example of extending a base set of fields & adding > > extras, yes it can be done as follows: > > timestamp=SQLTable(None,'timestamp', > > SQLField('created_on','datetime', > > readable=False, > > writable=False, > > default=request.now), > > SQLField('modified_on','datetime', > > readable=False, > > writable=False, > > default=request.now,update=request.now)) > > > > db.define_table('mytable',timestamp, > > SQLField('my_extra_field')) > > > > However this doesn't provide the ability to do a search of all sub- > > tables without a JOIN as-per Single-Table Inheritance: > http://groups.google.com/group/web2py/browse_thread/thread/d9715e7b75... > > > > I have no idea whether the Django version allows that or not... > > > > F > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

