perhaps the table names will be changed, so please don't bother about
"before" and "after"...the point is -- how to refer/link to the table
name "locus", when that table is not yet created/declared/made?

On 7/4/10, Rick Hultgren <sababa.sab...@gmail.com> wrote:
> Thanks for the answers. I'm trying to create these tables:
>
> db.define_table( 'substance',
>  Field( 'substance',  db.substance),
>  Field( 'process',  db.process),
>  Field( 'condition',  db.condition),
>  Field( 'locus',  db.locus),
>  Field( 'name'),
>  Field( 'main_name'))
>
> db.define_table( 'process',
>  Field( 'substance',  db.substance),
>  Field( 'process',  db.process),
>  Field( 'condition',  db.condition),
>  Field( 'locus',  db.locus),
>  Field( 'name'),
>  Field( 'main_name'))
>
> db.define_table( 'condition',
>  Field( 'substance',  db.substance),
>  Field( 'process',  db.process),
>  Field( 'condition',  db.condition),
>  Field( 'locus',  db.locus),
>  Field( 'name'),
>  Field( 'main_name'))
>
> db.define_table( 'locus',
>  Field( 'substance',  db.substance),
>  Field( 'process',  db.process),
>  Field( 'condition',  db.condition),
>  Field( 'locus',  db.locus),
>  Field( 'name'),
>  Field( 'main_name'))
>
>
> On 7/4/10, mdipierro <mdipie...@cs.depaul.edu> wrote:
>> Could you explain to us in English what you are trying to model? I am
>> sure there is a simpler solution using link tables.
>>
>> On 3 Lug, 12:14, Rick Hultgren <sababa.sab...@gmail.com> wrote:
>>> Thanks for the link. My actual problem is more complicated than the
>>> example I gave. I realize that I need to link a field to a table that
>>> isn't initiated yet (item2):
>>>
>>>         objects = ['substance', 'process', 'condition', 'locus']
>>>         linksubobjects = ['locus', 'before', 'after']
>>>         unlinksubobjects = ['name', 'main_name']
>>>         for object in objects:
>>>                 for item1 in linksubobjects+unlinksubobjects:
>>>                         for item2 in objects:
>>>                                 fields=[Field(item1, 'reference item2')]
>>>                                 db.define_table(object,*fields)
>>>
>>> I suppose the solution would be to initiate the table names and then
>>> add the fields either in db.py, or in the controller file. But I have
>>> no idea how to do this.
>>>
>>> On 7/3/10, Yarko Tymciurak <resultsinsoftw...@gmail.com> wrote:
>>>
>>> > The online book has a fairly useful search;
>>>
>>> > For your question, see:
>>> >http://web2py.com/book/default/section/6/13
>>>
>>> > Regards,
>>> > - Yarko
>>>
>>> > On Jul 3, 8:45 am, Rick <sababa.sab...@gmail.com> wrote:
>>> >> Hi,
>>>
>>> >> I would like to link a table to its own model like this:
>>>
>>> >>         db.define_table('person',
>>> >>                 Field('name'),
>>> >>                 Field('child', db.person))
>>>
>>> >> I understand that I should first initiate the table and then link it
>>> >> to itself. But how to do that?
>>>
>>> >> Thanks in advance for help!
>

Reply via email to