I am making an application to control government medical appointments
in more than fifty hospitals all use a single postgres database, but
each hospital must have administrator access, Operator and User, and
each access must be made with the view of their unique data .

is this.



       Ovidio Marinho Falcao Neto
                Web Developer
             [email protected]
          [email protected]
                 ITJP - itjp.net.br
               83   8826 9088 - Oi
               83   9334 0266 - Claro
                        Brasil



2012/6/27 pbreit <[email protected]>:
> I just started using it and it works fine.
>
> First, figure out what identifier you want to use to identify the tenant.
> The Web2py book shows an example that bases it on the URL's sub-domain (ex:
> tenant1.mysite.com, tenant2.mysite.com, etc.). I'm using the "id" field of a
> "shop" table so I have added this Field() to my tables:
>
> Field('request_tenant', default=shop_id, writable=False)
>
> I have code in my model to figure out "shop_id". Something like shop_id =
> db.shop(auth.user.shop_id)
>
> Then, for any query against a table with a request_tenant field, web2py
> automatically adds (db.shop.request_tenant==shop_id) to the query.
>
> Let us know if you have any specific questions.
>
>

Reply via email to