I have 2 tables about a hotel, one table registers the hotel itself & the
other is about meals that are offered at the hotel but the idea is that
only group members of each hotel have to & can only register meals for
their hotels. So to avoid mistakes & prevent malicious intentions I was
wondering if its possible to have the referencing field in the meals table
pre-selected appropriately for the logged in user with their correct hotel
name as per the group they belong to. I hope I make sense:
*MODEL CODE*
db.define_table('hotel_profile',
Field('hotel_name'),
Field('logo', 'upload'),
Field('tel1'),
Field('email_address'),
Field('directions', 'text', requires=IS_LENGTH(500)),
Field('google_directions'),
Field('posted_by', 'reference auth_user', default=auth.
user_id, readable=False, writable=False),
Field('groups', 'reference auth_group', default=get_group(),
readable=False, writable=False),
format='%(hotel_name)s'
)
db.define_table('meals',
Field('hotel', 'reference hotel_profile'),
Field('supper_price'),
Field('supper_details', 'text', requires=IS_LENGTH(200)),
Field('lunch_price'),
Field('lunch_details', 'text', requires=IS_LENGTH(200)),
Field('breakfast_price'),
Field('breakfast_details', 'text', requires=IS_LENGTH(200)),
Field('posted_by', 'reference auth_user', default=auth.
user_id, readable=False, writable=False),
Field('groups', 'reference auth_group', default=get_group(),
readable=False, writable=False)
)
Regards;
Mostwanted
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/be138b98-8d67-4a8d-bb77-b4410434f882%40googlegroups.com.