Hi there, this is my 3 attempts sending questions to this forum, i see
people sending questions here, but I don't see mine after I posted and
didn't get any reply. If someone can provide pointers, it's much
appreciated. (I just checked everything in the "Membership and email
setting", hope this post can be seen)
1st question: i want to use auth_user table to store my internal staffs and
external customers info, so that I can leverage all the built-in
authentication and authorisation functions provided by web2py out of the
box (please let me know if I should not do that). I added some fields in
auth_user as below, and got this error - 'Cannot resolve reference customer
in auth_user definition'if I didn't use lazy_tables=True in DAL. Is
lazy_tables=True the solution for this case?
auth.settings.extra_fields['auth_user']= [
Field('customer', 'reference customer'),
Field('mobile', requires=IS_NOT_EMPTY()),
Field('title', requires=IS_NOT_EMPTY()),
]
2nd question: I am building an accounting application and ticketing
application, eventually i want them to be 2 separate products used by my
clients, however I will use them internally. Should i build these 2
applications under separate web2py applications with 2 databases (then I
would have to maintain 2 duplicate set of user information)? Or i should
leverage CAS to store all the user/group/membership info in 'provider', and
let accounting & ticketing 'consumer' applications to access them (my test
didn't work with auth_user referencing customer table using CAS)? Or should
I create an auth_db = DAL(..) having these 2 web2py applications using this
auth_db connection for authentication/authorization, and create
accounting_db=DAL(..) and ticketing_db=DAL(..) for application specific
databases? Or I should put everything in a single web2py application
folder, create 2 controllers for accounting and ticketing respectively
(what if I want to sell the accounting application to a client but not the
ticketing application)? Sorry for the long question, they seem to have pros
and cons, want to hear opinions from experts.
3rd question: i have a customer table, an invoice table, an item table in
my accounting application, below is the simplified version. When I created
a view_customer() action with customer_grid =
SQLFORM.smartgrid(db.customer,linked_tables=['auth_user','invoice'],user_signature=False),
it only showed 'Auth users' link but not 'Invoice', why?
Now I tried to create invoice_grid=SQLFORM.smartgrid(db.invoice,
linked_tables=['item'],
constraints=dict(invoice=db.invoice.customer==request.args(0))), the
'Items' link (when I clicked) on the grid raised error - Query Not
Supported: invalid literal for long() with base 10: 'item' and 'no records
found. when i didn't have constraints set, the 'Items' link worked
correctly. Any ideas?
db.define_table('customer',
Field('company_name', requires=IS_NOT_EMPTY()),
auth.signature,
format='%(company_name)s')
db.define_table('invoice',
Field('customer', 'reference customer'),
Field('project_name', requires=IS_NOT_EMPTY()),
Field('invoice_total', 'double', default=0),
auth.signature)
db.define_table('item',
Field('invoice', 'reference invoice', writable=False),
Field('description'),
Field('unit_price', 'double'),
Field('quantity', 'integer'),
auth.signature)
Thanks so much in advance.
--
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/d/optout.