Wasn't this a no-no?.
I got wrist slapped once for suggesting it. :)

On Nov 11, 11:53 am, mdipierro <[email protected]> wrote:
> BTW. This is possible:
>
> db.define_table('company',
>     Field('name'),
>     Field('created_by', 'integer'))
> db.define_table('person',
>     Field('last_name'),
>     Field('company_id', 'reference company'))
>
> db.company.created_by.requires=IS_IN_DB(db,'person.id','%
> (last_name)s')
>
> although my object stands.
>
> On Nov 11, 10:46 am, DenesL <[email protected]> wrote:
>
> > I was thinking of scripted table creation and keeping things simple
> > but I understand what you are saying (or reiterating since it has been
> > said before).
>
> > If no valid case is made then I could change the manual to explain why
> > it is not supported.
> > Pros/Cons?
>
> > Denes.
>
> > On Nov 11, 11:18 am, mdipierro <[email protected]> wrote:
>
> > > From a syntactical point of view it would not take much to support
> > > multi-table circular references in web2py. That is not why they are
> > > not implemented, They are not implemented because they are bad design
> > > practice.
>
> > > If this is a 1-1 relation, there is no need to table A to refer to B
> > > and B to A. It is sufficient that A points to B.
>
> > > If this is a many-many this should be done via a link table.
>
> > > I cannot think of any test case when this is a good idea. web2py sets
> > > constraints for the purpose of enforcing good practice.
>
> > > Massimo
>
> > > On Nov 11, 10:05 am, DenesL <[email protected]> wrote:
>
> > > > Some of you have missed Mirek's point, and he has a very valid one.
> > > > The problem is circular references.
> > > > There are ways around it but no elegant solution yet.
>
> > > > There was discussion some time ago about lazy evaluation of tables.
>
> > > > I also would like to see this solved in web2py.
>
> > > > Denes.
>
> > > > On Nov 11, 10:36 am, Mirek Zvolský <[email protected]> wrote:
>
> > > > > >> Here's a link to the section in the book:
> > > > > >>http://www.web2py.com/book/default/chapter/06#Self-Reference-and-Aliases
>
> > > > > Yes, I know this, and from that reason I always use 'reference..'
> > > > > style syntax.
>
> > > > > However this is about very special foreign keys, which targets to same
> > > > > table (to the primary key in same table).
>
> > > > > And if there is some cycle in joins in the model (and of course it
> > > > > always is, except of very, very simple models), this will not help.
> > > > > And there is realy no solution for this in web2py ??

Reply via email to