Whats the mean the table blogpost_tag already that blogpost have a list reference to tag.
Em segunda-feira, 13 de março de 2017 10:08:32 UTC-3, Leonel Câmara escreveu: > > I actually like to have a list:reference on the table being tagged but > also have a table relating tags and the tagged table, This doesn't respect > data normalisation but makes things quite more efficient. > > To give an example: > db.define_table('tag', > Field('name'), > Field('count', 'integer', writable=False, default=0), > ) > > db.define_table('blogpost', > Field('title'), > Field('body'), > Field('tags', 'list:reference tag') > ) > > > db.define_table('blogpost_tag', > Field('blogpost', 'reference blogpost'), > Field('tag', 'reference tag'), > ) > > > I then define _after_insert, _after_update and _before_delete functions > for blogpost so I keep the blogpost_tag table updated when a blogpost is > changed or inserted. > > This makes it very efficient to both search using a given tag and to know > which tags a blogpost has. > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.