I think this error arises when two tables in factory have same field name. 
I usually get around this by naming one of the fields differently, but best 
practice is to name same foreign key identically in all tables it is used 
in.

Any better way to prevent this error?

thanks

Alex Glaros


<type 'exceptions.SyntaxError'> duplicate field organization_FK in table 
no_tableVersion
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Python Python 2.7.9: C:\alex\alt_web2py_6\web2py\web2py.exe (prefix: )
Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.

Traceback (most recent call last):
  File "C:\alex\alt_web2py_6\web2py\gluon\restricted.py", line 227, in 
restricted
    exec ccode in environment
  File "C:/alex/alt_web2py_6/web2py/applications/ES3/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/ES3/controllers/default.py>, line 
11052, in <module>
  File "C:\alex\alt_web2py_6\web2py\gluon\globals.py", line 417, in <lambda>
    self._caller = lambda f: f()
  File "C:\alex\alt_web2py_6\web2py\gluon\tools.py", line 4241, in f
    return action(*a, **b)
  File "C:/alex/alt_web2py_6/web2py/applications/ES3/controllers/default.py" 
<http://127.0.0.1:8000/admin/default/edit/ES3/controllers/default.py>, line 
4661, in view_specific_meeting
    form_add_new_meeting_segment = SQLFORM.factory(db.SuperObject, 
db.meeting_segment, db.auth_membership)
  File "C:\alex\alt_web2py_6\web2py\gluon\sqlhtml.py", line 1808, in factory
    return SQLFORM(DAL(None).define_table(table_name, *fields),
  File "C:\alex\alt_web2py_6\web2py\gluon\packages\dal\pydal\base.py", line 
834, in define_table
    table = self.lazy_define_table(tablename,*fields,**args)
  File "C:\alex\alt_web2py_6\web2py\gluon\packages\dal\pydal\base.py", line 
851, in lazy_define_table
    table = table_class(self, tablename, *fields, **args)
  File "C:\alex\alt_web2py_6\web2py\gluon\packages\dal\pydal\objects.py", line 
334, in __init__
    raise SyntaxError("duplicate field %s in table %s" % (field_name, 
tablename))
SyntaxError: duplicate field organization_FK in table no_table

Error snapshot [image: help] 
<http://127.0.0.1:8000/admin/default/ticket/ES3/127.0.0.1.2016-11-03.20-13-18.64811f3f-05ce-4d78-ac5e-86547b335278#>

<type 'exceptions.SyntaxError'>(duplicate field organization_FK in table 
no_table)

-- 
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.

Reply via email to