>
> *Problem1 :- Referenced field id is seen in grid, I want to have the
> referenced field 'name' value*
>
> Please insert few records using appadmin/grid and view the records, it
> will show the NAME field (DOG table) having the value as ID for the PERSON
> table. How can I view the name of the person name here and not the ID from
> PERSON table.
>
please do with record representation.
e.g.
db.define_table('person',
Field('name'),
Field('country'),
*format = '%(name)s'* )
ref:
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-representation
>
> *Problem2: In my case, Person field can have duplicate names, i.e.
> multiple records with the same name can be present. But I want that in DOG
> table, unique name to be seen in drop down list (seen in edit/add record).*
>
hm, not sure in here, i think, it can be boomerang to you. because you want
person field name can have duplicate name, but you want to eliminate it
(make it unique) in dog table owner field.
e.g.
person :
id : 1
name : kiba
country : sunagakure
id : 2
name : kiba
country : konohagakure
now, when i select the owner field in dog table, which kiba i refer to? it
will make the user confuse. you want to distinct it, then which kiba will
be eliminate then?
if you want duplicate name, i think you can add a field for describe it.
e.g. last_name, nick_name, etc. then if the name field can have duplicate,
that fine, but not the combination name and the other field (last_name,
nick_name, etc).
or for your current condition i think you can have the combination for name
and country field as record representation.
e.g.
db.define_table('person',
Field('name'),
Field('country'),
*format = '%(name)s **%(country)s**'* )
best regards,
stifan
--
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/groups/opt_out.