hi,
i found that :
1. notnull=True is not work without requires=IS_NOT_EMPTY()
2. length is not work without requires=IS_LENGTH()
3. uuid is not work in unique=True
is it normal or a bug?
for example:
*#models*
db.define_table('sale',
Field('invoice_no', length=30, notnull=True),
Field('product', 'reference product', notnull=True),
Field('quantity', 'integer', notnull=True),
Field('unit_price', 'decimal(10,2)', notnull=True),
Field('total_price', 'decimal(10,2)', notnull=True),
Field('grand_total', 'decimal(10,2)', notnull=True),
Field('note', 'text', notnull=True),
auth.signature)
*#controller*
def bill():
import datetime
import uuid
invoice_no=str(datetime.date.today())+'-'+str(uuid.uuid4())
form=SQLFORM.factory(Field('note', 'text'))
if form.accepts(request,session):
for key, value in session.order.items():
db.sale.insert(invoice_no=invoice_no,
product=key,
quantity=value,
unit_price=db.product(key).unit_price,
total_price=db.product(key).unit_price*value,
note=form.vars.note)
db(db.product.id==key).update(quantity=db.product.quantity -
value)
session.order.clear()
redirect(URL('invoice', args=invoice_no))
return dict(order=session.order, form=form)
1. in example above i didn't define requires=IS_NOT_EMPTY(), yet i still
can submit and get the data
2. in example above i didn't define requires=IS_LENGTH(), yet i still can
submit and get the data invoice that is more than i define in models
3. uuid is not work in unique=True, it returns an error, said invoice_no is
not unique, i think that uuid is unique id.
is there anyone know about this?
thank you so much before.
--
---
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.