hello everybody.....with this model I get some really strange
behaviours....is this a bug or a web2py limitation ?
db.py
-------------------
db.define_table('tablefoo',
Field('foo', length=5)
)
db.define_table('tablebar',
Field('bar', length=5)
)
db.define_table('tablefoobar',
Field('foo_ref', db.tablefoo),
Field('bar_ref', db.tablebar)
)
-------------------
so, I have two tables, tablefoo and tablebar with some values in it
and tablefoobar would have to store all the possible "connections"
between tablefoo and tablebar.
put 5 rows in tablefoo, 5 rows in tablebar and....
1st weird thing: appadmin/insert/db/tablefoobar returns two text
inputs:
<input type="text" value="" name="foo_ref" id="tablefoobar_foo_ref"
class="reference tablefoo">
class is "reference" so there's clearly something wrong with that...
2nd weird thing: no costraint on insertion , form is always accepted
(obviously if you try later to visualize the field in appadmin/update/
db/tablefoobar/1 a ticket is returned)
3rd weird thing: appadmin/update/db/tablefoobar/1 if you insert
meaningful records (i.e. existing in tablefoo and tablebar,
respectively) , it ends up having:
<input type="text" value="1" name="bar_ref" id="tablefoobar_bar_ref"
class="reference tablebar">
at least, it's coherent :-P
I tried also creating a controller and enforcing IS_IN_DB(), then
creating a form..... I end up having the same bahaviour...