Why create a constraint that requires extra work and its only purpose is to
reduce functionality?
While you believe the buyer will never be the customer this is a useless
constraint and distinction.
I would just auth_user and add two extra boolean fields (is_buyer,
is_customer) and set them according to your policies. You can then use to
registrations for them:
def register_buyer():
db.auth_user.is_buyer.default=True
db.auth_user.is_customer.default=False
return dict(form=auth.register())
def register_customer():
db.auth_user.is_buyer.default=False
db.auth_user.is_customer.default=True
return dict(form=auth.register())
and link them in the right places in your app.
On Monday, 11 August 2014 13:05:54 UTC-5, eric cuver wrote:
>
> i seen.. but i will not have this probleme because the buyer will never be
> the customer. but can you give me an example about your solution
> Le lundi 11 août 2014 19:30:20 UTC+2, Leonel Câmara a écrit :
>>
>> I wouldn't implement that solution. Well it depends on the objective, but
>> it seems wrong to me to have 2 user tables when the user being a customer
>> or buyer could just be a field.
>>
>> You could make this field readable=False, writable=False and then have
>> the register controller set the default differently according to the type
>> of user registration.
>>
>> The stackoverflow solution to me seems that it will create problems in
>> the future when suddenly you have users that are both or something like
>> that.
>>
>>
>>
--
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.