You should be able to reference the t_ab_distribution table from multiple
tables. Can you show the full models for these tables? What exactly broke
(i.e., what do you see, and what do you expect)?
Anthony
On Sunday, November 20, 2011 7:32:31 AM UTC-5, EdgarAllenPoe wrote:
>
> Well I may have spoke too soon...
>
> I have another table...this one:
>
> db.define_table('t_ab_team',
> [snip]
> Field('f_distribuionname', type='string',
> label=T('Distribuionname')),
>
> And I want to link the above field so that it show a drop down list
> also using the contents of the following field
>
> db.define_table('t_ab_distribution',
> Field('f_distributionname', type='string', unique=True,
> label=T('Distributionname')),
>
> So I tried this as I had before with the other drop down list that I
> wanted:
>
> Field('f_distribuionname', db.t_ab_distribution,
> label=T('Distribuionname')),
>
> Now I have broken something. Is this because I cannot explicitly link
> both
>
> db.t_ab_recipient.f_distribution_name ###would like this to show a
> drop down list
> db.t_ab_team.f_distribuionname ###would like this to show a
> drop down list
>
> to
>
> db.t_ab_distribution.f_distributionname ###contents of drop downlist
>
> or am I doing something else wrong?
>
> On Nov 20, 6:47 am, EdgarAllenPoe <[email protected]> wrote:
> > Thanks again Anthony,
> >
> > Your help has been clear and concise. I have what I need now.
> >
> > About the error thing. Just to be clear where I am working from. I
> > am using the online editor at:
> http://127.0.0.1:8000/admin/default/edit/XxxxxxXxxx/models/db_wizard.py
> >
> > And for a test I just removed one of the commas at the end of a line
> > and tried to save the file, which produced this error in an orange pop
> > up message:
> >
> > failed to compile file because:
> > SyntaxError at line 50 at char 8
> > invalid syntax (C:/web2py/applications/XxxxxxXxxx/models/db_wizard.py,
> > line 50)
> >
> > So I guess it is saving the file, but failing to compile. Would that
> > be a better way to state what is happening?
> >
> > Thanks again.
> >
> > On Nov 19, 6:14 pm, Anthony <[email protected]> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > > db.define_table('t_ab_recipient',
> > > > [snip]
> >
> > > change:
> >
> > > > Field('f_distribution_name', type='string',
> > > > label=T('Distribution Name')),
> >
> > > to:
> > > Field('f_distribution', db.t_ab_distribution,
> > > label=T('Distribution Name')),
> >
> > > Note, your code wouldn't be producing any errors on save (saving just
> saves
> > > the file -- it doesn't run or even check any of the code). If you're
> > > getting errors when merely trying to save the updated file, there's
> > > something else wrong (I'm not sure what).
> >
> > > Anthony
>
>