[web2py] Use import csv option to populate the SQLFORM

2013-09-29 Thread Sarbjit singh
Hi, I am having controller as : @auth.requires_login() def add(): form = SQLFORM(db.table) if form.process(formname='test').accepted: response.flash = 'Database Updated' elif form.errors: response.flash = 'Please fill all the required details' else: res

Re: [web2py] How can I check if a IS_IN_SET validator is set for a field and get the validtor values?

2013-07-26 Thread Sarbjit singh
Thanks a lot !! That's what I was looking for. -Sarbjit On Friday, July 26, 2013 7:53:28 PM UTC+5:30, Anthony wrote: > > isinstance(table[field].requires, IS_IN_SET) > > Anthony > > On Friday, July 26, 2013 8:56:13 AM UTC-4, Sarbjit singh wrote: >> >>

Re: [web2py] How can I check if a IS_IN_SET validator is set for a field and get the validtor values?

2013-07-26 Thread Sarbjit singh
an do field.requires.theset (for the > values), field.requires.labels (for the labels), or > field.requires.options() for a list of tuples of values and labels. > > You can also create a SELECT object via SQLFORM.widgets.options.widget(field, > value=field.default). > > Anthony

Re: [web2py] How can I check if a IS_IN_SET validator is set for a field and get the validtor values?

2013-07-26 Thread Sarbjit singh
ller default.py > def index(): > form = SQLFORM(db.persons).process() > return locals() > > #views default/index.html > {{extend 'layout.html'}} > {{=form}} > > > Mind we tend to call table names with singular not plural (person, not > persons). This wil

[web2py] How can I check if a IS_IN_SET validator is set for a field and get the validtor values?

2013-07-25 Thread Sarbjit singh
I have a db where I have set validator IS_IN_SET on a particular field. I am generating table rows (to be used as form), so I need to check if a particular field is having IS_IN_SET validator set and I want to retrieve the set values. Reason I want to do this is that I am generating a dynamic f

[web2py] Re: How do I pass a query object to a different controller?

2013-07-18 Thread Sarbjit singh
18, 2013 12:36:25 PM UTC+5:30, Sarbjit singh wrote: > > Just to be clear on exception (crash) : > > On clicking search, pickle error is seen if the url is like : > > > http://127.0.0.1:8000/sampleapp/default/search2/edit/customer/2?_signature=. > .. > > If it is s

[web2py] Re: How do I pass a query object to a different controller?

2013-07-18 Thread Sarbjit singh
edit/view forms are seen on redirection from "results" view back to "search2". -Sarbjit On Thursday, July 18, 2013 9:18:18 AM UTC+5:30, Sarbjit singh wrote: > > Thanks guys for the help. > > I followed the approach as suggested by Massimo, so I did the foll

[web2py] Re: How do I pass a query object to a different controller?

2013-07-17 Thread Sarbjit singh
gt;> HI, >>> you can pass results to the next page; >>> redirect(URL("test",vars=dict(results=results)) >>> >>> On the next page you can do >>> return dict(results=request.vars["results"]) >>> >>> Am Mittwoch, 17. J

[web2py] Re: How do I pass a query object to a different controller?

2013-07-17 Thread Sarbjit singh
rshall/etc). > > On Wednesday, 17 July 2013 05:37:24 UTC-5, Sarbjit singh wrote: >> >> Hi, >> >> I am trying to use "dynamic search form" from >> http://www.web2pyslices.com/slice/show/1403/dynamic-search. Current >> implementation shows both the form a

[web2py] How do I pass a query object to a different controller?

2013-07-17 Thread Sarbjit singh
Hi, I am trying to use "dynamic search form" from http://www.web2pyslices.com/slice/show/1403/dynamic-search. Current implementation shows both the form and results on the same page. I want to display the search results (using GRID) in a new page and wants to use customized forms for edit/view

[web2py] SQLFORM grid returns a error : query object has no attribute _tablename

2013-07-15 Thread Sarbjit singh
I am doing the following steps : >>> db = DAL('sqlite://storage.db') >>> db.define_table('person', Field('name'), Field('country')) >>> db.person.insert(name='John', country='UK') >>> db.person.insert(name='David', country='US') >>> query = db.person.name=="David" >>> SQLFORM.smartgrid(query) Tr

Re: [web2py] dynamic search form

2013-07-15 Thread Sarbjit singh
On Monday, April 26, 2010 7:17:55 AM UTC+5:30, mr.freeze wrote: > > Just thought I would share a small slice I made recently. It's creates > a search form for a table with selectable fields and criteria. > http://www.web2pyslices.com/main/slices/take_slice/78 > > > -- > Subscription settings:

Re: [web2py] Re: dynamic search form

2013-07-15 Thread Sarbjit singh
Hi, I have been trying to use the dynamic search with SMARTGRID. But it is not working. I modified the code as : results = db(query).select(*selected) ==MODIFIED TO ==> results = SQLFORM.smartgrid(query) With this modification, it is giving the below error :- "Query" object has no attr

[web2py] Re: How to control smartgrid search widget height and width?

2013-07-15 Thread Sarbjit singh
/blob/master/applications/welcome/static/css/web2py.css#L192 > down > > > Il giorno lunedì 15 luglio 2013 10:27:35 UTC+2, Sarbjit singh ha scritto: >> >> I am using default searchwidget available in SMARTGRID and want to >> customize the size of search entry window.

[web2py] How to use labels as elements inside the search widget of smartgrid?

2013-07-15 Thread Sarbjit singh
I am using smartgrid to create a grid for the records present in the database. I have labelled all the database elements as : db.mytable.myname.label = 'Name' Now in the grid which is generated does shows "Name" in the table header and in the drop-down which is used to build search queries. Now

[web2py] Re: Smartgrid custom form problem

2013-07-15 Thread Sarbjit singh
d.custom.widget.name/>.update_form > .custom.widget.name <http://grid.custom.widget.name/>}} > {{=grid.update_form.custom.submit}} > {{=grid.update_form.custom.end}} > {{else:}} > {{=grid}} > {{pass}} > > On Sunday, 14 July 2013 23:14:03 UTC-5, Sarbjit singh wrote: >> >>

[web2py] How to control smartgrid search widget height and width?

2013-07-15 Thread Sarbjit singh
I am using default searchwidget available in SMARTGRID and want to customize the size of search entry window. I am having a large number of database options which can be used for searching records from db, so I want to make my search window long enough (increase both width and height) such that

[web2py] Smartgrid custom form problem

2013-07-14 Thread Sarbjit singh
Hi, I am using customized form for adding records into database and using smartgrid to view/edit the records inserted in the database. Since, I am using the customized form for adding records into the database, I want to use the same layout for Edit operation (from SMARTGRID). To achieve this,

[web2py] Re: how to highlight empty field in custom sqlform

2013-07-12 Thread Sarbjit singh
7;s the error_message argument of any validator... > > http://web2py.com/books/default/chapter/29/07#Validators > > Il giorno venerdì 12 luglio 2013 08:55:08 UTC+2, Sarbjit singh ha scritto: >> >> Actually, I am new to web2py and wasn't aware of it. My requirement was >&g

[web2py] Re: how to highlight empty field in custom sqlform

2013-07-11 Thread Sarbjit singh
r: why complicate things when you can use > form.custom ??? > > http://web2py.com/books/default/chapter/29/07#Custom-forms > > Il giorno venerdì 12 luglio 2013 08:19:35 UTC+2, Sarbjit singh ha scritto: >> >> >> I have defined a model in which some fields were marked as

[web2py] how to highlight empty field in custom sqlform

2013-07-11 Thread Sarbjit singh
I have defined a model in which some fields were marked as "IS_NOT_EMPTY", now when I am using SQLFORM generated form, then if a user clicked on "submit", then if that particular field is empty, it shows a message in red color indicating which field is having empty value. Now since my requirem

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-07-11 Thread Sarbjit singh
Finally, I am able to do it :) http://www.web2pyslices.com/slice/show/1622/how-to-authorize-users-editing-records-only-for-records-that-were-created-by-tho On Thursday, July 11, 2013 12:37:53 PM UTC+5:30, Sarbjit singh wrote: > > Just to be clear on my requirement : > > Taking

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-07-11 Thread Sarbjit singh
Just to be clear on my requirement : Taking "Image Blog" example provided in web2py manual, I want to achieve the following functionality : 1) Multiple user's to be able to add images. 2) There should be one "View Records" page which should display all the records with buttons like edit/delete/

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-07-10 Thread Sarbjit singh
Hi everyone, Can some one please help me on this issue. I need a working example where few table entries are editable (only for the user who has entered the information). Thanks Sarbjit -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group.

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-28 Thread Sarbjit singh
Thanks 黄祥, Can you please share the code. -Sarbjit On Tuesday, March 26, 2013 5:10:20 AM UTC+5:30, 黄祥 wrote: > > it can, yesterday i've already tested it, i'll share the code when i'm at > the office. -- --- You received this message because you are subscribed to the Google Groups "web2py-

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-25 Thread Sarbjit singh
Just one question, were you able to get the results in the grid as : ROW1 -- Editable (means showing view, delete and edit buttons) ROW2 -- Non Editable (means showing only view button) ROW3 -- Non Editable (means showing only view button) ROW4 -- Editable (means showing view, delete and edit butt

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-25 Thread Sarbjit singh
I did added it in grid, my controller is : @auth.requires_login() def rent(): grid=SQLFORM.grid(db.company, user_signature=False, editable = auth.has_permission('edit','auth_user'), deletable = auth.has_permission('delete','auth_user')) return

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-25 Thread Sarbjit singh
I tried the same, now all the results are non editable, it seems I need to add user_login to edit permission. I am doing the below for adding the permission, but not successful. auth.add_permission('edit','mana...@test.com', 'company', 0) Just one more question: since this expression will re

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-25 Thread Sarbjit singh
thanks for reply. I tried modifying the controller as per the company model that you provided earlier. But I am getting following error : 'DAL' object has no attribute 'auth' Sorry for this basic question, but I am a beginner to web2py. Hope you can help me to resolve this issue. So my model

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-24 Thread Sarbjit singh
Well, I was able to run the code. Problem with this is that in this case if user is "Manager", then all the rows are editable and if it is other user including "Admin", then rows are read only. My requirement is let's say I have a database where each user can insert some data and at the same ti

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-24 Thread Sarbjit singh
@黄祥, *Its still giving error: *Table has no attribute 'gender' and '* *'custom_auth_table' not defined. Db.py # -*- coding: utf-8 -*- from gluon.tools import Auth db = DAL("sqlite://storage.sqlite") auth = Auth(db) auth.settings.create_user_groups=True auth.define_tables(username=False, signatur

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-23 Thread Sarbjit singh
@黄祥, Below is my complete db.py, I am getting error in registration of user stating gender can't be null. # -*- coding: utf-8 -*- from gluon.tools import Auth db = DAL("sqlite://storage.sqlite") auth = Auth(db) auth.settings.create_user_groups=True auth.define_tables(username=False, signature=T

[web2py] Re: How to get selective update rows from SQLFROM.grid

2013-03-23 Thread Sarbjit singh
Thanks Alan. Since, I am a beginner, I will study the mentioned chapters and would try. In case of any problem, I will revert back. @ 黄祥, I gave it a quick try, In this case when has_membership is True, all of the rows in the grid are editable. My requirement is to get few rows of the grid edi

[web2py] How to get selective update rows from SQLFROM.grid

2013-03-22 Thread Sarbjit singh
Hello All, I am a newbie to web2py and developing my test app. I want to present all the entries in a db using SQLFORM.grid with the option to edit/delete rows based on user name. e.g. My models are like: Person table with entries name, userid, address, phone number. Controller looks like :

[web2py] Re: Doubt in the example provided on web2py manual page 98

2013-03-15 Thread Sarbjit singh
te a default display for any data. The next sentence > provides instruction for customizing the default index.html view for this > example: > > Proceed to create a view for the index action. Return to admin, edit >> "default/index.html" and replace its content with

[web2py] Re: Doubt in the example provided on web2py manual page 98

2013-03-14 Thread Sarbjit singh
clears my doubt -Sarbjit On Thursday, March 14, 2013 9:04:31 PM UTC+5:30, Mark wrote: > > If you don't have a view (such as index.html), the generic view > (generic.html) will be used. Isn't it clear? > > On Thursday, March 14, 2013 7:54:38 AM UTC-4, Sarbjit singh wrote:

Re: [web2py] Doubt in the example provided on web2py manual page 98

2013-03-14 Thread Sarbjit singh
> {{else:}} > {{=BEAUTIFY(response._vars)}} > {{pass}} > > If theres no content it renders the BEAUTIFY(response._vars) just like the > generic view, so its not the generic view being rendered but a similar view. > > > > 2013/3/14 Sarbjit singh > > >> In the 5th

[web2py] Re: web2py default server in production

2013-03-14 Thread Sarbjit singh
e web2py "more capable": > tell us what's your OS and we can come up with solutions. > > On Thursday, March 14, 2013 9:45:38 AM UTC+1, Sarbjit singh wrote: >> >> Hi, >> >> I have started learning web2py for web development in Python. Initially I

[web2py] Doubt in the example provided on web2py manual page 98

2013-03-14 Thread Sarbjit singh
In the 5th edition of web2py manual, for the example of images app, I have one doubt :- As per that app code, we create db in models (db.py) and then we write some code in controller (default.py) as :- def index(): images = db().select(db.image.ALL, orderby=db.image.title) return dict(ima

[web2py] web2py default server in production

2013-03-14 Thread Sarbjit singh
Hi, I have started learning web2py for web development in Python. Initially I started with Django, but found on internet that web2py is easy to learn and provides more features over django. However I have one basic question :- Can I use default web2py server in production. I want to build an da