There is a piece here that is dense, has caused some confusion and deserves
a comment:

On Sun, Apr 26, 2009 at 1:32 PM, DolleDries <[email protected]>wrote:

>
> Given the model for web2py-wiki:
>
>
> db.define_table('tag',
>   db.Field('name'))
>
> db.tag.name.requires=IS_NOT_EMPTY()
>
> db.define_table('page',
>   db.Field('uuid',length=128,writable=False,default=str(uuid.uuid4
> ())),
>   db.Field('title'),
>   db.Field('menu',length=128),
>   db.Field('public','boolean',default=False),
>   db.Field('active','boolean',default=True),
>   db.Field('body','text'),
> *#*  db.Field('tags','text'),

*   # yarko prefers more "explicit" naming:

    db.Field("tag_ids, 'text'),

   # note: id's == multiple references;
   # it's defined as text but holds a string of foreign keys,  '|12|14|22|'
   # this _could_ be done as a one-to-many table entry, eg:  keys: field -
page;  field - tag
   # but this '|1|2|3|' is web2py implementation, an efficiency for when
this won't hold too many
   # not sure what the trade off point is (Massimo could comment)
   # ... perhaps a 1000 keys would do better with a separate table???
*

>
>   db.Field('created_by',db.auth_user,default=who,writ#able=False),
>   db.Field('created_on','datetime',default=now,writable=False))
>
> db.page.title.requires=IS_NOT_EMPTY()
> db.page.tags.requires=IS_IN_DB(db,'tag.id','%(name)s',multiple=True)
>
>
> Can somebody explain to to me what is meant by the last line???
>
> It seems to me this line has a diffenrent meaning: db.Field
> ('tags','text').
> I believe it should be somthing like: db.Field('tags', db.tag) or
> perhaps a SET or ENUM of tags...
>
> Put how is that produced dynamicly? Haven't found anything in the book
> or API yet..
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to