The two tables I am defining are as follows
db.define_table('Series',
Field('name'),
Field('SeriesBy', 'reference DataItem'),
format='%(name)s')
db.define_table('SeriesReportInstanceIndicatorInstance',
Field('Series', 'reference Series'),
Field('ReportInstanceIndicatorInstance' 'reference
ReportInstanceIndicatorInstance'),
Field('this_series_name'))
The Series table gets defined fine. The error I get is the following
<type 'exceptions.SyntaxError'> Field: invalid field name:
ReportInstanceIndicatorInstancereference ReportInstanceIndicatorInstance,
use rname for "funny" names
when I attempt to reference the already established
ReportInstanceIndicatorInstance table below
db.define_table('ReportInstanceIndicatorInstance',
Field('ReportInstance', 'reference ReportInstance'),
Field('IndicatorInstance', 'reference IndicatorInstance'),
Field('GroupBy', 'reference DataItem'),
Field('GroupBy2', 'reference DataItem'),
Field('title'),
Field('x_axis_label'),
Field('y_axis_label'),
Field('report_data_id'),
format= '%(title)s')
On Thursday, 17 March 2016 14:30:36 UTC, Anthony wrote:
>
> According to the error, your field name is "field1reference table1", so
> you probably have an error in the field definition. Please show your model
> code.
>
> Anthony
>
> On Thursday, March 17, 2016 at 8:28:00 AM UTC-4, Heather Dawe wrote:
>>
>> Hi there,
>>
>> I have had this error in a couple of scenarios now. I have an established
>> and working web2py app and I wish to add a couple of tables to the model. A
>> number of fields in these new tables reference fields in established
>> tables. I get this error when trying to create the new tables
>>
>> <type 'exceptions.SyntaxError'> Field: invalid field name:
>> field1reference table1, use rname for "funny" names
>>
>> where 'field1' is the name of a field in the new table I am trying to
>> create that references table1 (the id field in table1). Given that all I am
>> trying to do is add a new table to my model which has a field that
>> references an existing table I don't see why this is a problem? I have
>> looked into it and searched for the error etc. I have tried to fix it by
>> changing to migrate='false' and fake_migrate='true' etc. but this has not
>> solved it. Can anyone please advise why I am getting this error and how to
>> sort it out?
>>
>> Many thanks,
>> Heather
>>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.