[web2py] Error viewing table due to invalid format!

2012-06-20 Thread rahulserver
I changed the web2py ajax.html date format and also used the IS_DATE constraint to get the date in dd-mm- format. When I submit the data via sqlform, everything is ok.but When I added an extra date element in the sqlform and tried to insert it in a table using

[web2py] Problem while using two sqlform.grid in a single form

2012-06-18 Thread rahulserver
I tried to use two sqlform.grid in a web2py form. It does work as intended except for the problem that when I try to edit on of the form's row, other form's row with same Id also appears to be edited. How should i stop it? my controller: def CommitmentBrowse_rep():

[web2py] Problems with using downloaded layouts

2012-06-18 Thread rahulserver
I am facing two problems in general with downloaded layouts from web2py site: 1) whenever a form or table extends beyond the page body area, it goes beyound the middle area's margin.In default layout, the middle area appears to expand to accomodate the form or table. 2) In Sqlform.grid or

[web2py] Edit or delete not committing in sqlform.grid for custom query

2012-06-12 Thread rahulserver
I have the following sqlform.grid: COMMITMENTS=SQLFORM.grid((db.Commitments.Account==session.id),user_signature=False) When I try to edit any row of the form, the edit is not committing. Is it that the sqlform.grid does not allow edits for query arguments?

[web2py] form with variable number of fields

2012-06-11 Thread rahulserver
Is there a way to create a form from controller(or view) in web2py to have variable number of fields depending on query? To be more specific,I have following table in my model: db.define_table('Commitments',Field('Account',requires=IS_IN_DB(db,db.Account_Master.id, '%(Account)s

[web2py] Unable to insert data into sqllite database

2012-06-09 Thread rahulserver
Hi! I have the following table in my model: db.define_table('Transaction_Master',Field('Account',db.Account_Master,requires=IS_IN_DB(db,'Account_Master.id', '%(Account)s %(State)s',zero=T('choose

[web2py] Accessing extra sqlform elements from view

2012-06-06 Thread rahulserver
I added this extra element to my sqlform (as given in web2py book chapter forms and validators): form = SQLFORM(db.yourtable) my_extra_element = TR(LABEL('I agree to the terms and conditions'), \ INPUT(_name='agree',value=True,_type='checkbox'))

[web2py] ondelete cascade on id attribute

2012-05-27 Thread rahulserver
How should i specify ondelete='Cascade' on the id attribute of the parent table, since we do not usually specify the id attribute in web2py tables.

[web2py] Format representation in foreign table.

2012-05-20 Thread rahulserver
I have two tables: db.define_table('Account_Master',Field('Account',requires=IS_NOT_EMPTY()),Field('Sewadari1'),Field('Mb1'),Field('Sewadari2'),Field('Mb2'),Field('City'),Field('District'),Field('State'),Field('Email'),Field('Remark'),format='%(Account)s %(State)s ')

[web2py] Re: Format representation in foreign table.

2012-05-20 Thread rahulserver
, db.Transaction_Master.id, lambda r: '%s %s %s' % (db.Account_Master[r.Account].Account, r.Exam_Date, r.id)) )) With Regards, rahulserver. On Sunday, May 20, 2012 6:01:14 PM UTC+5:30, rahulserver wrote: I have two tables: db.define_table('Account_Master',Field('Account',requires=IS_NOT_EMPTY()),Field

[web2py] Computed Column specification based on child table attributes in web2py

2012-05-20 Thread rahulserver
I have 2 tables: db.define_table('Transaction_Master',Field('Account',db.Account_Master,requires=IS_IN_DB(db,'Account_Master.id', '%(Account)s %(State)s',zero=T('choose

[web2py] Read an excel file without uploading it

2012-05-04 Thread rahulserver
I want to import data from excel sheets to the database in web2py. I wish to validate the excel sheet before importing data from it.My table structure is similar to db.define_table('xlsheets',Field('name'),Field('xl','upload'),Field('filename')) From this table, i will obtain the filename field

[web2py] Exception not thrown for duplicate values.

2012-05-04 Thread rahulserver
I am importing data from a csv file and the field declaration is as:Field('Account',requires=IS_NOT_EMPTY(),unique=True). But no exception is thrown when duplicate values for the field is imported! In one of the posts, I have read that it is an sqllite specific issue which I am using for

[web2py] insert into web2py tablel with field indices

2012-04-29 Thread rahulserver
The insert function in web2py expects db.tablename.insert(...) with column name and value pairs. What if the table has lengthy field names and i wish to insert in the table by iterating through all the fields. I tried: for field in db[db.MyTable]: nme='\''+field.name+'\''

[web2py] File generation using web2py

2012-04-28 Thread rahulserver
I wish to generate a few reports in csv or txt or other file formats based on some database data maintained through a crud application. Previously, it was done through an asp.net application with vb as scripting language.But as I explored the wonderful capabilities of web2py, I have become a

[web2py] Read excel sheet in web2py

2012-04-28 Thread rahulserver
I wish to read an excel sheet in web2py.I tried few samples from python codes which use the xlrd object.However in web2py, when I import the xlrd object, I get the following error: type 'exceptions.ImportError' No module named xlrd So why is it like that? And is there any way to read an excel

[web2py] AJAX form submission using CRUD in web2py

2012-04-06 Thread rahulserver
Is it possible to validate CRUD form fields using ajax without submitting the form in web2py? I have gone through the web2py online doc and have seen this link: http://web2py.com/books/default/chapter/29/11#Ajax-form-submission So we may do it using custom html. But I want to do it using