[web2py] Re: Grid: case insensitive sort

2022-11-04 Thread Dave S
On Thursday, November 3, 2022 at 8:57:23 AM UTC-7 vincent...@gmail.com 
wrote:

> Hello,
>
> I have a simple SQLFORM.grid that shows the rows of my simple SQLite 
> database.
> In the grid, when I click on, say, the "vendorname" column header, this 
> performs a kind of alphabetical sort, but the sort is case sensitive, so 
> for example "AXE" comes before "Abc". How can I make the grid achieve a 
> case insensitive sort?
>
> Thanks
>

You have to write the query to be case insensitive, as none of the other 
grid parameters are helpful.

/dps


-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c6bd4073-f902-4518-8ac3-05612cdcd6e2n%40googlegroups.com.


[web2py] Re: grid: top + button: how to adapt dynamically & translate the title 'add record to database' ?

2020-05-04 Thread Luciano Bovio
I have the same problem on translation I have to modify button text 
with jQuery. Any ideas ?

On Monday, February 12, 2018 at 7:01:17 AM UTC-3, Serge Bourgeois wrote:
>
>
> Hello,
> The following codes changes dynamically the title of the button on the top 
> left of the form in English.
> But when I switch to another language (exemple FR), I get the French 
> translation of 'Add record to database', and not the translation of what I 
> have placed in the title of this button.
>
> Example:
>
> form = SQLFOR.smartgrid(db[my_table]..., showbuttontext=False, ...)
>
> if not 'view' in request.args and not 'edit' in request.args and not 
> 'new' in request.args:
>addbutton = form.element(_title='Add record to database')
>my_table = 'my application table'
>addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular 
> return dict(form = form)
> => in English, the title of the + button is 'Add' + the value of 
> db[my_table]._singular : This is perfect!
> => in French, I always get 'Ajout d'un enregistrement', which is the 
> translation of 'Add record to database'. : this is not what I want...
>
> I have tried the following, but, same result:
>if not 'view' in request.args and not 'edit' in request.args and not 
> 'new' in request.args:
>my_title = T('Add record to database)'
>addbutton = form.element(_title= my_title)
>my_table = 'my application table'
>addbutton['_title'] = '%s %s' % ( T('Add'), db[my_table]._singular 
> return dict(form = form)
>
> Thanks for any advise for translating the title of the top left '+' button 
> when I change if in the controller.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/58f35739-a7b6-4905-903d-b8d4b04a1c09%40googlegroups.com.


Re: [web2py] Re: grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Jim S
Wow, way better than what I've been doing.

I'm going to have to take a look at that.

Thanks!

-Jim


On Friday, April 24, 2020 at 12:28:56 PM UTC-5, Vlad wrote:
>
> I see. Thank you. 
>
> I also did some Googling and found what I think should be documented more 
> explicitly and perhaps more clearly in web2py docs (it's there, but unless 
> you know what to look for, you're guaranteed to miss it):
>
> when creating grid, the following
>args=request.args[:1]
> tells the grid to keep the arguments in place and reload on top of 
> existing one(s) - this seems to be a perfect solution by design! 
>
> On Fri, Apr 24, 2020 at 1:18 PM Jim S > 
> wrote:
>
>> So, you have to manage that yourself.
>>
>> I do it kind of like this.  Yes, I know it's ugly but it pretty much 
>> works.
>>
>> #  if the variable is passed in, get the value
>> search_text = request.get_vars.search_text
>>
>> if request.wsgi.environ['QUERY_STRING'] != '':
>> #  we get here if no vars were passed on the request - in 
>> #  this case, I want to see if I've saved a copy of them to session
>> #  and if so, grab them and use them
>> if not search_text:
>> try:
>> search_text = session['search_values']['search_text']
>> except:
>> search_text = ''
>>
>> #  now I use search text to build the query I'm going to pass to 
>> SQLFORM.grid
>>
>> #  store the current value of the variables back to your session
>> session.search_values = dict(search_text=search_text)
>>
>> Not pretty, but it works for my use case.
>>
>> -Jim
>>
>>
>>
>>
>> On Friday, April 24, 2020 at 11:58:23 AM UTC-5, Vlad wrote:
>>>
>>> Yes, there are arguments on the page already. I don't want the grid to 
>>> get rid of them when reloading for those actions. 
>>>
>>> On Fri, Apr 24, 2020, 12:39 PM Jim S  wrote:
>>>
 I thought it did keep track of paging.  

 Are you looking for it to keep arguments that you supplied?

 -Jim

 On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:
>
> I've got a page with a grid on it. 
> grid reloads the page on create and other actions. 
> the page to begin with has arguments, for example, page/1/2/3. 
> I want the grid to keep these 1/2/3 in place when reloading the page 
> on those actions, for example, on new record it should use page/1/2/3/new 
> instead of page/new. 
> How do I achieve it? There must be a parameter that enables grid to 
> keep the args, but I can't find it - 
>
 -- 
 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 a topic in the 
 Google Groups "web2py-users" group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com
  
 
 .

>>> -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/3f80cee5-4f2d-44f5-95bb-458bcfd52c93%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/d5a89f25-c36f-45b7-bf6a-42bae591774d%40googlegroups.com.


Re: [web2py] Re: grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Eliezer (Vlad) Tseytkin
I see. Thank you.

I also did some Googling and found what I think should be documented more
explicitly and perhaps more clearly in web2py docs (it's there, but unless
you know what to look for, you're guaranteed to miss it):

when creating grid, the following
   args=request.args[:1]
tells the grid to keep the arguments in place and reload on top of existing
one(s) - this seems to be a perfect solution by design!

On Fri, Apr 24, 2020 at 1:18 PM Jim S  wrote:

> So, you have to manage that yourself.
>
> I do it kind of like this.  Yes, I know it's ugly but it pretty much works.
>
> #  if the variable is passed in, get the value
> search_text = request.get_vars.search_text
>
> if request.wsgi.environ['QUERY_STRING'] != '':
> #  we get here if no vars were passed on the request - in
> #  this case, I want to see if I've saved a copy of them to session
> #  and if so, grab them and use them
> if not search_text:
> try:
> search_text = session['search_values']['search_text']
> except:
> search_text = ''
>
> #  now I use search text to build the query I'm going to pass to
> SQLFORM.grid
>
> #  store the current value of the variables back to your session
> session.search_values = dict(search_text=search_text)
>
> Not pretty, but it works for my use case.
>
> -Jim
>
>
>
>
> On Friday, April 24, 2020 at 11:58:23 AM UTC-5, Vlad wrote:
>>
>> Yes, there are arguments on the page already. I don't want the grid to
>> get rid of them when reloading for those actions.
>>
>> On Fri, Apr 24, 2020, 12:39 PM Jim S  wrote:
>>
>>> I thought it did keep track of paging.
>>>
>>> Are you looking for it to keep arguments that you supplied?
>>>
>>> -Jim
>>>
>>> On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:

 I've got a page with a grid on it.
 grid reloads the page on create and other actions.
 the page to begin with has arguments, for example, page/1/2/3.
 I want the grid to keep these 1/2/3 in place when reloading the page on
 those actions, for example, on new record it should use page/1/2/3/new
 instead of page/new.
 How do I achieve it? There must be a parameter that enables grid to
 keep the args, but I can't find it -

>>> --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/3f80cee5-4f2d-44f5-95bb-458bcfd52c93%40googlegroups.com
> 
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDBsFgvHP1w-1-N8-hUx7MLS7B4hRJwP-gxkEzjr0qtag%40mail.gmail.com.


Re: [web2py] Re: grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Jim S
So, you have to manage that yourself.

I do it kind of like this.  Yes, I know it's ugly but it pretty much works.

#  if the variable is passed in, get the value
search_text = request.get_vars.search_text

if request.wsgi.environ['QUERY_STRING'] != '':
#  we get here if no vars were passed on the request - in 
#  this case, I want to see if I've saved a copy of them to session
#  and if so, grab them and use them
if not search_text:
try:
search_text = session['search_values']['search_text']
except:
search_text = ''

#  now I use search text to build the query I'm going to pass to 
SQLFORM.grid

#  store the current value of the variables back to your session
session.search_values = dict(search_text=search_text)

Not pretty, but it works for my use case.

-Jim




On Friday, April 24, 2020 at 11:58:23 AM UTC-5, Vlad wrote:
>
> Yes, there are arguments on the page already. I don't want the grid to get 
> rid of them when reloading for those actions. 
>
> On Fri, Apr 24, 2020, 12:39 PM Jim S > 
> wrote:
>
>> I thought it did keep track of paging.  
>>
>> Are you looking for it to keep arguments that you supplied?
>>
>> -Jim
>>
>> On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:
>>>
>>> I've got a page with a grid on it. 
>>> grid reloads the page on create and other actions. 
>>> the page to begin with has arguments, for example, page/1/2/3. 
>>> I want the grid to keep these 1/2/3 in place when reloading the page on 
>>> those actions, for example, on new record it should use page/1/2/3/new 
>>> instead of page/new. 
>>> How do I achieve it? There must be a parameter that enables grid to keep 
>>> the args, but I can't find it - 
>>>
>> -- 
>> 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 a topic in the 
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3f80cee5-4f2d-44f5-95bb-458bcfd52c93%40googlegroups.com.


Re: [web2py] Re: grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Eliezer (Vlad) Tseytkin
Yes, there are arguments on the page already. I don't want the grid to get
rid of them when reloading for those actions.

On Fri, Apr 24, 2020, 12:39 PM Jim S  wrote:

> I thought it did keep track of paging.
>
> Are you looking for it to keep arguments that you supplied?
>
> -Jim
>
> On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:
>>
>> I've got a page with a grid on it.
>> grid reloads the page on create and other actions.
>> the page to begin with has arguments, for example, page/1/2/3.
>> I want the grid to keep these 1/2/3 in place when reloading the page on
>> those actions, for example, on new record it should use page/1/2/3/new
>> instead of page/new.
>> How do I achieve it? There must be a parameter that enables grid to keep
>> the args, but I can't find it -
>>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/llt-aRxLeBo/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com
> 
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCAh%3DOjAOxzhhKmrqtcwu0P5jwwLFJNKSgYZChVWKT4W2A%40mail.gmail.com.


[web2py] Re: grid reloading the page on grid actions (and keeping the page's arguments)

2020-04-24 Thread Jim S
I thought it did keep track of paging.  

Are you looking for it to keep arguments that you supplied?

-Jim

On Friday, April 24, 2020 at 11:33:47 AM UTC-5, Vlad wrote:
>
> I've got a page with a grid on it. 
> grid reloads the page on create and other actions. 
> the page to begin with has arguments, for example, page/1/2/3. 
> I want the grid to keep these 1/2/3 in place when reloading the page on 
> those actions, for example, on new record it should use page/1/2/3/new 
> instead of page/new. 
> How do I achieve it? There must be a parameter that enables grid to keep 
> the args, but I can't find it - 
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6638c197-7342-4e11-8b86-8b4606f1847a%40googlegroups.com.


[web2py] Re: Grid sorting bug when default orderby column type is date

2019-05-03 Thread jcrmatos
It was confirmed to be a bug in web2py and it is now corrected.


quinta-feira, 28 de Março de 2019 às 18:41:59 UTC, João Matos escreveu:
>
> Hello,
>
> I have this action
>
> @auth.requires(auth.has_membership(CHECKER_ROLE) or auth.has_membership(
> SUPERVISOR_ROLE))
> def list_tags_to_issue():
> """List tags to issue.
>
> :return: Dict with grid.
> """
>
>query = ((db.wo.is_active == True)
> & (db.wo.tags_issued == False)
> & (db.wo.pies_verified == False)
> & (db.wo.equipment_id == db.equipment.id))
>
> grid = SQLFORM.grid(
> query,
> create=False,
> csv=False,
> deletable=False,
> details=False,
> editable=False,
> fields=[db.wo.est_finish,
> db.equipment.name,
> db.wo.sn,
> db.wo.opts,
> db.wo.finished,  # Necessary dummy entry.
> db.wo.canceled_on,  # Necessary dummy entry.
> db.wo.canceled_by,  # Necessary dummy entry.
> db.wo.cancel_approved_by,  # Necessary dummy entry.
> ],
> orderby=db.wo.est_finish,
> )
>
> return dict(grid=grid)
>
> With this view
>
> {{extend 'layout.html'}}
>
> {{=T('List tags to issue')}}
>
> {{=grid}}
>
> {{if DEV:
> =response.toolbar()
> pass}}
>
> If I try to change the sorting in the default orderby column (est_finish) 
> it doesn't occur.
> The URL is changed from  ...orderby=do.wo.est_finish to 
> ...orderby=~db.wo.est_finish, but the grid doesn't change.
> When I see the db stats, the SQL command also didn't change.
> The SQL command is always
>
> SELECT "wo"."est_finish", "equipment"."name", "wo"."sn", "wo"."opts", 
> "wo"."finished", "wo"."canceled_on", "wo"."canceled_by", 
> "wo"."cancel_approved_by", "wo"."id" 
> FROM "wo", "equipment" 
> WHERE "wo"."is_active" = 'T') AND ("wo"."tags_issued" = 'F')) AND 
> ("wo"."pies_verified" = 'F')) AND ("wo"."equipment_id" = "equipment"."id")) 
> ORDER BY "wo"."est_finish", "wo"."id" LIMIT 20 OFFSET 0;
>
> no matter the URL changing from ...orderby=do.wo.est_finish to 
> ...orderby=~db.wo.est_finish.
>
> This is one of 3 different views (all have in common a orderby with a date 
> column) that show this problem. All others work correctly.
>
> If I remove the orderby parameter from the grid or change it to a non-date 
> one, everything works, including the sorting of the date column.
>
> Any ideas?
>
> Thanks,
>
> JM
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
Found the solution.

I have to add
args=request.args[:1],
to the child grid.

terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu:
>
> What do you mean by master-child pages? Are you using smartgrid? Can you 
> show some code?
>
> On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search and clear buttons don't restore request.args. Where can I 
>> correct that?
>>
>>
>> If using master-child pages, the master grid search works fine (because 
>> there are no request.args), but the child grid (which has request.args, 
>> from the master record) doesn't because the search and clear buttons don't 
>> restore the request.args.
>>
>>
>> web2py 2.18.5
>> Python 3.7.1 x86
>> Firefox 66.0.3 x64
>> Windows 7 Pro x64 SP1+all upds
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
Just noticed now that both search and clear search buttons URLs also remove 
the search=1 var, but maintain the sid var. Strange isn't it?


terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu:
>
> What do you mean by master-child pages? Are you using smartgrid? Can you 
> show some code?
>
> On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search and clear buttons don't restore request.args. Where can I 
>> correct that?
>>
>>
>> If using master-child pages, the master grid search works fine (because 
>> there are no request.args), but the child grid (which has request.args, 
>> from the master record) doesn't because the search and clear buttons don't 
>> restore the request.args.
>>
>>
>> web2py 2.18.5
>> Python 3.7.1 x86
>> Firefox 66.0.3 x64
>> Windows 7 Pro x64 SP1+all upds
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-30 Thread jcrmatos
I have a master page (in this case an equipment's grid) where I have links 
to child tables.
The URL for the equipment's page is
http:
//jmatos-p:8000/equipment?search=1&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

In this page the search and clear search buttons work fine and show the 
correct URLs, but this page doesn't have args.

When I go to one of the child's page (using the grid link) I have the below 
URL. Every child page contains a grid with the child's table records.
http:
//jmatos-p:8000/single_equip/index/11?search=1&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

The URL after pressing the search button is changed to (the args are gone 
and this is the problem)
http:
//jmatos-p:8000/single_equip?keywords=equip_ps.ps_id+%3D+%224%22&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

The URL after pressing clear search button is changed to (the args are gone 
and this is the problem)
http:
//jmatos-p:8000/single_equip?keywords=&sid=d4b3d39a-b6bc-4c41-af05-d2e9bf7ea195

The search and clear search actions work fine. The problem is only the URLs 
they construct that are missing the args.



terça-feira, 30 de Abril de 2019 às 00:37:24 UTC+1, Anthony escreveu:
>
> What do you mean by master-child pages? Are you using smartgrid? Can you 
> show some code?
>
> On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search and clear buttons don't restore request.args. Where can I 
>> correct that?
>>
>>
>> If using master-child pages, the master grid search works fine (because 
>> there are no request.args), but the child grid (which has request.args, 
>> from the master record) doesn't because the search and clear buttons don't 
>> restore the request.args.
>>
>>
>> web2py 2.18.5
>> Python 3.7.1 x86
>> Firefox 66.0.3 x64
>> Windows 7 Pro x64 SP1+all upds
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid search collects all records from all fields on each request. Isn't this bad for performance?

2019-04-30 Thread jcrmatos
Ok, thanks Anthony.

terça-feira, 30 de Abril de 2019 às 00:34:10 UTC+1, Anthony escreveu:
>
> On Monday, April 29, 2019 at 6:22:26 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid search collects all records from all fields on each request. Isn't 
>> this bad for performance?
>>
>
> Are you referring to "reference" fields, which result in a select element 
> showing associated values from the foreign table? If so, that is the result 
> of the default IS_IN_DB validator given to such fields, which results in a 
> select element being created when the field appears in forms as well as the 
> search menu. You can override this behavior by putting the validator in a 
> list:
>
> db.mytable.myreferencefield.requires = [db.mytable.myreferencefield]
>
> However, in that case, forms and the search menu will simply present a 
> numeric input field, and you would need to search by the record ID, so 
> probably not very useful. Alternatively, you can specify an autocomplete 
> widget, but that won't help in the grid search menu.
>  
>
>> Isn't it possible to change this behavior to only load the records when 
>> the user selects a specific field to do the search?
>>
>
> Feel free to submit a pull request. Alternatively, you can specify both a 
> custom search menu and a custom search function via the "search_widget" and 
> "searchable" arguments, respectively. For ideas on the former, see 
> SQLFORM.search_menu, and for the latter, see SQLFORM.build_query.
>
> Anthony
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid search and clear buttons don't restore request.args. Where can I correct that?

2019-04-29 Thread Anthony
What do you mean by master-child pages? Are you using smartgrid? Can you 
show some code?

On Monday, April 29, 2019 at 6:15:30 PM UTC-4, jcrma...@gmail.com wrote:
>
> Grid search and clear buttons don't restore request.args. Where can I 
> correct that?
>
>
> If using master-child pages, the master grid search works fine (because 
> there are no request.args), but the child grid (which has request.args, 
> from the master record) doesn't because the search and clear buttons don't 
> restore the request.args.
>
>
> web2py 2.18.5
> Python 3.7.1 x86
> Firefox 66.0.3 x64
> Windows 7 Pro x64 SP1+all upds
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid search collects all records from all fields on each request. Isn't this bad for performance?

2019-04-29 Thread Anthony
On Monday, April 29, 2019 at 6:22:26 PM UTC-4, jcrma...@gmail.com wrote:
>
> Grid search collects all records from all fields on each request. Isn't 
> this bad for performance?
>

Are you referring to "reference" fields, which result in a select element 
showing associated values from the foreign table? If so, that is the result 
of the default IS_IN_DB validator given to such fields, which results in a 
select element being created when the field appears in forms as well as the 
search menu. You can override this behavior by putting the validator in a 
list:

db.mytable.myreferencefield.requires = [db.mytable.myreferencefield]

However, in that case, forms and the search menu will simply present a 
numeric input field, and you would need to search by the record ID, so 
probably not very useful. Alternatively, you can specify an autocomplete 
widget, but that won't help in the grid search menu.
 

> Isn't it possible to change this behavior to only load the records when 
> the user selects a specific field to do the search?
>

Feel free to submit a pull request. Alternatively, you can specify both a 
custom search menu and a custom search function via the "search_widget" and 
"searchable" arguments, respectively. For ideas on the former, see 
SQLFORM.search_menu, and for the latter, see SQLFORM.build_query.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal?

2019-04-29 Thread jcrmatos
So the only way to correct it is the way I used. Thanks Anthony.

segunda-feira, 29 de Abril de 2019 às 23:56:18 UTC+1, Anthony escreveu:
>
> Yes. It shows the values from the foreign table via "recursive selects" 
> (i.e., a separate query for each displayed row after the initial set of 
> records is fetched from the database), so it is not able to use that 
> information for sorting (which would require the initial query to be a join 
> with the foreign table).
>
> Anthony
>
> On Monday, April 29, 2019 at 6:26:10 PM UTC-4, jcrm...@gmail.com 
>  wrote:
>>
>> Grid sorting sorts by id (in case of a FK) instead of shown value (eg. 
>> name). Is this normal?
>>
>> The only way I found to correct this behavior was to change the grid's 
>> table to a query, where in this query I include all the foreign fields (eg. 
>> name) directly and remove al the foreign keys.
>> Is this the correct/only way to solve it?
>>
>>
>> web2py 2.18.5
>> Python 3.7.1 x86
>> Firefox 66.0.3 x64
>> Windows 7 Pro x64 SP1+all upds
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid sorting sorts by id (in case of a FK) instead of shown value (eg. name). Is this normal?

2019-04-29 Thread Anthony
Yes. It shows the values from the foreign table via "recursive selects" 
(i.e., a separate query for each displayed row after the initial set of 
records is fetched from the database), so it is not able to use that 
information for sorting (which would require the initial query to be a join 
with the foreign table).

Anthony

On Monday, April 29, 2019 at 6:26:10 PM UTC-4, jcrma...@gmail.com wrote:
>
> Grid sorting sorts by id (in case of a FK) instead of shown value (eg. 
> name). Is this normal?
>
> The only way I found to correct this behavior was to change the grid's 
> table to a query, where in this query I include all the foreign fields (eg. 
> name) directly and remove al the foreign keys.
> Is this the correct/only way to solve it?
>
>
> web2py 2.18.5
> Python 3.7.1 x86
> Firefox 66.0.3 x64
> Windows 7 Pro x64 SP1+all upds
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid sorting questions (referenced fields and case sensitive)

2019-03-29 Thread João Matos
Found a kludge to sort the grid's search fields list.

# Sort grid's search fields list.
grid.element('#w2p_query_fields').components = 
sort_grid_search_fields_list(grid)


def sort_grid_search_fields_list(grid: gluon.DIV) -> List[gluon.OPTION]:
"""Sort grid's search fields list.

:param grid: Grid.
:return: Sorted search fields list (HTML options).
"""
keys: List[str] = []
elements: Dict[str, str] = {}
for element in grid.element('#w2p_query_fields').components:  # type: 
gluon.OPTION
keys.append(element.flatten())
elements[element.flatten()] = element['_value']
keys.sort(key=str.lower)
return [gluon.OPTION(key, _value=elements[key]) for key in keys]


quinta-feira, 28 de Março de 2019 às 21:13:04 UTC, João Matos escreveu:
>
> Hello,
>
> I have these 2 tables opt and opt_cat, where opt depends on opt_cat for 
> the category name and other settings.
>
> db.define_table('opt',
> Field('name', 'string', label=T('Name'), length=NAME_LEN, 
> notnull=True,
>   required=True, unique=True),
> Field('opt_cat_id', 'reference opt_cat', label=T(
> 'Category'),
>   notnull=True, required=True),
> auth.signature,
> format='%(name)s',
> )
>
> db.define_table('opt_cat',
> Field('name', 'string', label=T('Name in Portuguese'), 
> length=NAME_LEN,
>   notnull=True, required=True, unique=True),
> Field('name_en', 'string', label=T('Name in English'),
>   length=NAME_LEN, notnull=True, required=True, unique
> =True),
> Field('mandatory', 'boolean', default=False,
>   label=T('Mandatory'), notnull=True, required=True),
> Field('one_opt_only', 'boolean', default=False,
>   label=T('One option only'), notnull=True, required=
> True),
> auth.signature,
> format='%(name)s',
> )
>
> I was testing grid sort and found that a grid like this
>
> table = db.opt
>
> grid = SQLFORM.grid(
> table,
> csv=False,
> details=False,
> maxtextlength=GRID_COL_LEN_FOR_TEXT,
> ondelete=on_delete,  # Grid only.
> onvalidation=on_validation,  # Form only.
> orderby=db.opt.name,
> paginate=session.auth.user.pagination,
> # represent_none='',  # Grid and view form only.
> )
>
> will sort by opt_cat_id and not by the opt_cat.name that is shown.
> The only solution I've found is to make a join between the 2 columns and 
> show the client.name directly.
>
> query = db.opt.opt_cat_id == db.opt_cat.id
>
> grid = SQLFORM.grid(
> query,
> csv=False,
> details=False,
> field_id=db.opt.id,
> fields=[
> db.opt.name,
> db.opt_cat.name,
> db.opt_cat.name_en,
> ],
> headers={'opt_cat.name': T('Category'), 'opt_cat.name_en': T(
> 'Category')},
> maxtextlength=GRID_COL_LEN_FOR_TEXT,
> ondelete=on_delete,  # Grid only.
> onvalidation=on_validation,  # Form only.
> orderby=db.opt.name,
> paginate=session.auth.user.pagination,
> # represent_none='',  # Grid and view form only.
> )
>
>
> Is there a better solution?
>
> Another question is that I see that the sorting is ASCII based (small case 
> after upper case).
>
> Is there any way to make it sort without being case sensitive?
>
> One last question. Is there any way to sort the fields names in the search 
> fields list of a grid?
>
>
> Thanks,
>
> JM
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: grid reloading the page and outdated flash msgs? (strange behavior...)

2018-12-27 Thread Eliezer (Vlad) Tseytkin
I got it,
finally,
It was purely mystical for me, but now it makes sense... Grid is quite a
sophisticated beast and does some magic behind the stage...

Thank you very much!



On Thu, Dec 27, 2018 at 11:08 PM Anthony  wrote:

> This simply displays an old fashioned grid. Nothing fancy. But now
>> consider just exactly same code, with 2 extra lines (if (id==0):
>> redirect(home) :
>>
>> def test():
>> id = 0
>> try:
>> id = request.args(0, cast=int)
>> except:
>> id = 0
>> pass
>> if (id==0):
>> redirect('home')
>> grid = SQLFORM.grid(db.test_table, user_signature=False)
>> return locals()
>>
>> Now, this looks exactly like the previous one - but this grid is NOT
>> functional. Neither create nor delete work! The buttons are there, but the
>> create and delete functions do NOT perform.
>>
>> Please note that I always specify the parameters - app/default/test/1
>>  or app/default/test/100 - it's never called without a parameter. So
>> logically, unless I am missing something, if (id==0) should never be the
>> case - right?
>>
>
> As mentioned earlier, if you want to use some URL args in your code that
> should not apply to the grid, you must make this explicit by passing args
> that must be preserved by the grid via its "args" argument. See
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Using-requests-args-safely.
> This tells the grid to preserve the URL args you are using in any URLs it
> creates, and to ignore those args internally.
>
> Anthony
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: grid reloading the page and outdated flash msgs? (strange behavior...)

2018-12-27 Thread Anthony

>
> This simply displays an old fashioned grid. Nothing fancy. But now 
> consider just exactly same code, with 2 extra lines (if (id==0): 
> redirect(home) :  
>
> def test():
> id = 0
> try:
> id = request.args(0, cast=int)
> except:
> id = 0
> pass
> if (id==0):
> redirect('home')
> grid = SQLFORM.grid(db.test_table, user_signature=False)
> return locals()
>
> Now, this looks exactly like the previous one - but this grid is NOT 
> functional. Neither create nor delete work! The buttons are there, but the 
> create and delete functions do NOT perform. 
>
> Please note that I always specify the parameters - app/default/test/1   or 
> app/default/test/100 - it's never called without a parameter. So logically, 
> unless I am missing something, if (id==0) should never be the case - right?
>

As mentioned earlier, if you want to use some URL args in your code that 
should not apply to the grid, you must make this explicit by passing args 
that must be preserved by the grid via its "args" argument. 
See 
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Using-requests-args-safely.
 
This tells the grid to preserve the URL args you are using in any URLs it 
creates, and to ignore those args internally.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: grid reloading the page and outdated flash msgs? (strange behavior...)

2018-12-27 Thread Eliezer (Vlad) Tseytkin
Antony, thank you very much, I got the 1st and the 3rd ones. But about the
2nd one it's tricky. Without going into details of why I need it, could you
please just glance at the following code that works 100%:

def test():
id = 0
try:
id = request.args(0, cast=int)
except:
id = 0
pass
   """ another 100 lines of code is cut off here
grid = SQLFORM.grid(db.test_table, user_signature=False)
return locals()

I am calling it, for example, like this:app/default/test/1
How I use this id field it doesn't really matter - I've simply extracted
the essence of what's going on, leaving another 100 lines of code out.

This simply displays an old fashioned grid. Nothing fancy. But now consider
just exactly same code, with 2 extra lines (if (id==0): redirect(home) :

def test():
id = 0
try:
id = request.args(0, cast=int)
except:
id = 0
pass
if (id==0):
redirect('home')
grid = SQLFORM.grid(db.test_table, user_signature=False)
return locals()

Now, this looks exactly like the previous one - but this grid is NOT
functional. Neither create nor delete work! The buttons are there, but the
create and delete functions do NOT perform.

Please note that I always specify the parameters - app/default/test/1   or
app/default/test/100 - it's never called without a parameter. So logically,
unless I am missing something, if (id==0) should never be the case - right?

What I was surprised to find out was that WHEN I, for example, click delete
button on the grid - the page quietly reloads and this time it's called
without my parameter (without be doing anything and without me being aware
of this), thus (id==0) condition is true, executes appropriate code (which
was never meant to be executed if everything goes right), and this is how
it's somehow messes up delete and create.

I hope I've explained better this time...

On Thu, Dec 27, 2018 at 6:35 PM Anthony  wrote:

> On Thursday, December 27, 2018 at 4:05:40 PM UTC-5, Vlad wrote:
>>
>> Here is a test function in my controller:
>>
>> def test():
>> id = 0
>> try:
>> id = request.args(0, cast=int)
>> session.flash = "Here is the id: " + str(id)
>> except:
>> session.flash = "ID is not valid!"
>> pass
>> if id==0:
>> redirect(URL('home'))
>> query = db.test_table.id == id
>> grid = SQLFORM.grid(query, db.test_table, user_signature=False)
>> return locals()
>>
>
> Regarding the flash message, you should be setting response.flash, not
> session.flash (the latter goes in the session and will not be displayed
> until the *next *request, as you have observed -- it is typically used
> just before a redirect).
>
> What are you attempting to do with this function? Why are you even using
> the grid if you are only intending to display a single record?
>
> Note, your code does nothing in case the request.args(0) is not a valid
> integer -- in that case, your function still returns a grid (though
> presumably using a query you don't want). You might instead want to do a
> redirect in that case.
>
> Also, if your function is going to make use of some of the URL args, you
> must indicate this to the grid by passing in the URL args it is supposed to
> use (via the "args" argument).
>
> Finally, actions other than reading data require either a logged in user
> or user_signature=False.
>
> Anthony
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid reloading the page and outdated flash msgs? (strange behavior...)

2018-12-27 Thread Anthony
On Thursday, December 27, 2018 at 4:05:40 PM UTC-5, Vlad wrote:
>
> Here is a test function in my controller: 
>
> def test():
> id = 0
> try:
> id = request.args(0, cast=int)
> session.flash = "Here is the id: " + str(id)
> except:
> session.flash = "ID is not valid!"
> pass
> if id==0:
> redirect(URL('home'))
> query = db.test_table.id == id
> grid = SQLFORM.grid(query, db.test_table, user_signature=False)
> return locals()
>

Regarding the flash message, you should be setting response.flash, not 
session.flash (the latter goes in the session and will not be displayed 
until the *next *request, as you have observed -- it is typically used just 
before a redirect).

What are you attempting to do with this function? Why are you even using 
the grid if you are only intending to display a single record?

Note, your code does nothing in case the request.args(0) is not a valid 
integer -- in that case, your function still returns a grid (though 
presumably using a query you don't want). You might instead want to do a 
redirect in that case.

Also, if your function is going to make use of some of the URL args, you 
must indicate this to the grid by passing in the URL args it is supposed to 
use (via the "args" argument).

Finally, actions other than reading data require either a logged in user or 
user_signature=False.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column names do not print nicely

2017-12-20 Thread Anthony

>
>
>> Probably we should add some code to web2py-bootstrap3.css to remove some 
>> of the URLs from the grid when printing (e.g., headings, pagination links, 
>> etc.). If you'd like, open a github issue and link to this thread.
>>
>> Anthony
>>
>
>
> Would there need to be a way to override that?  [as in a parameter  that 
> defaults to remove?]  Or is it hard to find someone who would want to keep 
> the links?
>

Could always edit the CSS. But I don't see a good reason why you would want 
these particular URLs to be printed -- they're just used for internal 
navigation.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column names do not print nicely

2017-12-20 Thread Dave S


On Wednesday, December 20, 2017 at 11:13:18 AM UTC-8, Anthony wrote:
>
> Bootstrap includes CSS to print the href values for any links. To disable 
> this just for links within a web2py grid, you can add the following CSS 
> somewhere:
>
> @media print {
> .web2py_table a[href]:after {
> content: none !important;
> }
> }
>
>
One of my first questions (for SQLTABLE, though) back in Oct 2013  :-)
 

> Probably we should add some code to web2py-bootstrap3.css to remove some 
> of the URLs from the grid when printing (e.g., headings, pagination links, 
> etc.). If you'd like, open a github issue and link to this thread.
>
> Anthony
>


Would there need to be a way to override that?  [as in a parameter  that 
defaults to remove?]  Or is it hard to find someone who would want to keep 
the links?

/dps



-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column names do not print nicely

2017-12-20 Thread icodk
Thanks Anthony

Eliminating buttons:


.btn{
 display: none !important;
}



Eliminating breadcrumb: 

  .w2p_grid_breadcrumb_elem{
 display: none !important;
}

All inside @media print {

}

The magic continue:-)


On Wednesday, December 20, 2017 at 8:13:18 PM UTC+1, Anthony wrote:
>
> Bootstrap includes CSS to print the href values for any links. To disable 
> this just for links within a web2py grid, you can add the following CSS 
> somewhere:
>
> @media print {
> .web2py_table a[href]:after {
> content: none !important;
> }
> }
>
> If you only want to eliminate the URLs from the column headings but leave 
> other URLs within the table, you can use the selector ".web2py_table th 
> a[href]:after". If you want to eliminate more URLs, you can use a more 
> general selector (e.g, "a[href]:after" will get rid of all link URLs 
> anywhere on the page).
>
> Probably we should add some code to web2py-bootstrap3.css to remove some 
> of the URLs from the grid when printing (e.g., headings, pagination links, 
> etc.). If you'd like, open a github issue and link to this thread.
>
> Anthony
>
> On Wednesday, December 20, 2017 at 6:17:13 AM UTC-5, icodk wrote:
>>
>> When in grid or smartgrid trying to print the page with browser's own 
>> print function, columns name comes out as URLS of the page instead of the 
>> text of the name of the column name. 
>> Could be nice to be able to print with browser own print function.
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid column names do not print nicely

2017-12-20 Thread Anthony
Bootstrap includes CSS to print the href values for any links. To disable 
this just for links within a web2py grid, you can add the following CSS 
somewhere:

@media print {
.web2py_table a[href]:after {
content: none !important;
}
}

If you only want to eliminate the URLs from the column headings but leave 
other URLs within the table, you can use the selector ".web2py_table th 
a[href]:after". If you want to eliminate more URLs, you can use a more 
general selector (e.g, "a[href]:after" will get rid of all link URLs 
anywhere on the page).

Probably we should add some code to web2py-bootstrap3.css to remove some of 
the URLs from the grid when printing (e.g., headings, pagination links, 
etc.). If you'd like, open a github issue and link to this thread.

Anthony

On Wednesday, December 20, 2017 at 6:17:13 AM UTC-5, icodk wrote:
>
> When in grid or smartgrid trying to print the page with browser's own 
> print function, columns name comes out as URLS of the page instead of the 
> text of the name of the column name. 
> Could be nice to be able to print with browser own print function.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


{Disarmed} [web2py] Re: grid IS_IMAGE validator behavior

2017-12-07 Thread Carlos Cesar Caballero Díaz
Yes, first I crete the entry using the grid add form without problems, 
when I open the edit form, the image is in the field, but when I submit 
the form without changes, the validator says that there is no image.



El 06/12/17 a las 14:32, Dave S escribió:



On Wednesday, December 6, 2017 at 11:06:02 AM UTC-8, Carlos Cesar 
Caballero wrote:


That's the issue, I don't want null values, the user shouldn't
remove the image without upload a new one, but when I use the
grid's edit form, the validation error is triggered if the user
edit another field, so the form can't be submitted without
uploading a new image.



Does the edit form ... and that field in particular ... get 
pre-populated?  If so, the existing value should be what is submitted.


But I'm a bit vague about SQLFORM.grid(), so I'm not going to be much 
help.


/dps

El 06/12/17 a las 13:06, Val K escribió:

yes, if you want to allow null-value  - use IS_EMPTY_OR wrapper
IS_EMPTY_OR(IS_IMAGE(...))

On Wednesday, December 6, 2017 at 8:48:06 PM UTC+3, Carlos Cesar
Caballero wrote:

Hi, I have being using web2py for some time, but I don't use
files too
often, now I am using the IS_IMAGE, but using the grid on
edit it's
throwing a validation error if the user don't set a new image.

It's a bug or is the default behavior?

-- 
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 web2py+un...@googlegroups.com .
For more options, visit *MailScanner ha detectado un intento de
fraude en la siguiente p�gina web "groups.google.com". /No/
conf�e en esta p�gina web:* *MailScanner ha detectado un intento
de fraude en la siguiente página web "groups.google.com". /No/
confíe en esta página web:* *MailScanner ha detectado un intento
de fraude en la siguiente p�gina web "groups.google.com". /No/
conf�e en esta p�gina web:* https://groups.google.com/d/optout
.


--
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 web2py+unsubscr...@googlegroups.com 
.
For more options, visit *MailScanner ha detectado un intento de fraude 
en la siguiente p�gina web "groups.google.com". /No/ conf�e en esta 
p�gina web:* https://groups.google.com/d/optout 
.


--
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: {Disarmed} Re: {Disarmed} [web2py] Re: grid IS_IMAGE validator behavior

2017-12-06 Thread Dave S


On Wednesday, December 6, 2017 at 11:06:02 AM UTC-8, Carlos Cesar Caballero 
wrote:
>
> That's the issue, I don't want null values, the user shouldn't remove the 
> image without upload a new one, but when I use the grid's edit form, the 
> validation error is triggered if the user edit another field, so the form 
> can't be submitted without uploading a new image.
>
>
Does the edit form ... and that field in particular ... get pre-populated?  
If so, the existing value should be what is submitted.

But I'm a bit vague about SQLFORM.grid(), so I'm not going to be much help.

/dps

El 06/12/17 a las 13:06, Val K escribió:
>
> yes, if you want to allow null-value  - use IS_EMPTY_OR wrapper  
>
> IS_EMPTY_OR(IS_IMAGE(...))
>
>
> On Wednesday, December 6, 2017 at 8:48:06 PM UTC+3, Carlos Cesar Caballero 
> wrote: 
>>
>> Hi, I have being using web2py for some time, but I don't use files too 
>> often, now I am using the IS_IMAGE, but using the grid on edit it's 
>> throwing a validation error if the user don't set a new image. 
>>
>> It's a bug or is the default behavior? 
>>
>> -- 
> 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 web2py+un...@googlegroups.com .
> For more options, visit *MailScanner ha detectado un intento de fraude en 
> la siguiente página web "groups.google.com". No confíe en esta página web:* 
> *MailScanner 
> ha detectado un intento de fraude en la siguiente p�gina web 
> "groups.google.com". No conf�e en esta p�gina web:* 
> https://groups.google.com/d/optout .
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


{Disarmed} Re: {Disarmed} [web2py] Re: grid IS_IMAGE validator behavior

2017-12-06 Thread Carlos Cesar Caballero Díaz
That's the issue, I don't want null values, the user shouldn't remove 
the image without upload a new one, but when I use the grid's edit form, 
the validation error is triggered if the user edit another field, so the 
form can't be submitted without uploading a new image.



El 06/12/17 a las 13:06, Val K escribió:

yes, if you want to allow null-value  - use IS_EMPTY_OR wrapper
IS_EMPTY_OR(IS_IMAGE(...))

On Wednesday, December 6, 2017 at 8:48:06 PM UTC+3, Carlos Cesar 
Caballero wrote:


Hi, I have being using web2py for some time, but I don't use files
too
often, now I am using the IS_IMAGE, but using the grid on edit it's
throwing a validation error if the user don't set a new image.

It's a bug or is the default behavior?

--
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 web2py+unsubscr...@googlegroups.com 
.
For more options, visit *MailScanner ha detectado un intento de fraude 
en la siguiente p�gina web "groups.google.com". /No/ conf�e en esta 
p�gina web:* https://groups.google.com/d/optout 
.


--
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid IS_IMAGE validator behavior

2017-12-06 Thread Val K
yes, if you want to allow null-value  - use IS_EMPTY_OR wrapper 

IS_EMPTY_OR(IS_IMAGE(...))


On Wednesday, December 6, 2017 at 8:48:06 PM UTC+3, Carlos Cesar Caballero 
wrote:
>
> Hi, I have being using web2py for some time, but I don't use files too 
> often, now I am using the IS_IMAGE, but using the grid on edit it's 
> throwing a validation error if the user don't set a new image. 
>
> It's a bug or is the default behavior? 
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-04 Thread Dave S


On Friday, August 4, 2017 at 1:42:54 PM UTC-7, Seth J wrote:
>
> So, archives on this page: https://github.com/niphlod/web2py/releases  
> don't contain it?!?! 
>

I'm not sure.  I would expect the zip files to, but that's a dev's archive 
rather than the "official" web2py archive referenced in the 
web2py.com/init/default/downloads page.

/dps
 

>
> On Friday, August 4, 2017 at 4:34:16 PM UTC-4, Dave S wrote:
>>
>>
>>
>> On Friday, August 4, 2017 at 1:17:08 PM UTC-7, Seth J wrote:
>>>
>>> Another quick question.  How do I  revert back to 2.14.6 or 2.14.5 
>>> then?  I downloaded the appropriate version archive and replaced all of the 
>>> files in the installation and it still gives me the same error message:
>>>
>>
>> If you're pulling from the github archive, you need to do a recursive 
>> pull to get the correct version of PyDal.   The zip files, during their 
>> time on the download page, take care of that for you.
>>
>> /dps
>>
>>
>>  
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-04 Thread Seth J
So, archives on this page: https://github.com/niphlod/web2py/releases  
don't contain it?!?! 

On Friday, August 4, 2017 at 4:34:16 PM UTC-4, Dave S wrote:
>
>
>
> On Friday, August 4, 2017 at 1:17:08 PM UTC-7, Seth J wrote:
>>
>> Another quick question.  How do I  revert back to 2.14.6 or 2.14.5 then?  
>> I downloaded the appropriate version archive and replaced all of the files 
>> in the installation and it still gives me the same error message:
>>
>
> If you're pulling from the github archive, you need to do a recursive pull 
> to get the correct version of PyDal.   The zip files, during their time on 
> the download page, take care of that for you.
>
> /dps
>
>
>  
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-04 Thread Dave S


On Friday, August 4, 2017 at 1:17:08 PM UTC-7, Seth J wrote:
>
> Another quick question.  How do I  revert back to 2.14.6 or 2.14.5 then?  
> I downloaded the appropriate version archive and replaced all of the files 
> in the installation and it still gives me the same error message:
>

If you're pulling from the github archive, you need to do a recursive pull 
to get the correct version of PyDal.   The zip files, during their time on 
the download page, take care of that for you.

/dps


 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-04 Thread Seth J
Another quick question.  How do I  revert back to 2.14.6 or 2.14.5 then?  I 
downloaded the appropriate version archive and replaced all of the files in 
the installation and it still gives me the same error message:

Version
web2py™ Version 2.14.5-stable+timestamp.2016.04.13.22.22.13
Python Python 2.7.10: C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.

Traceback (most recent call last):
  File ".\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "C:/inetpub/wwwroot/applications/CongressionalOfficeDev/models/db.py" 
,
 line 133, in 
migrate=settings.migrate)
  File "C:\inetpub\wwwroot\gluon\packages\dal\pydal\base.py", line 587, in 
define_table
table = self.lazy_define_table(tablename, *fields, **args)
  File "C:\inetpub\wwwroot\gluon\packages\dal\pydal\base.py", line 596, in 
lazy_define_table
fields = list(fields) + [f.clone() for f in common_fields]
AttributeError: 'Table' object has no attribute 'clone'



On Thursday, August 3, 2017 at 1:24:08 PM UTC-4, Leonel Câmara wrote:
>
> Seth that 2.15.2 bug has been fixed in trunk. Please wait for 2.15.3
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid show or hidden table coloumn

2017-08-04 Thread Massimo Di Pierro
Yes. The SQLFORM.grid(..., fields=[dt.table.field1, ...],..) let you 
specify the fields to display.

On Tuesday, 1 August 2017 03:32:58 UTC-5, 黄祥 wrote:
>
> is it possible to show or hidden table coloumn in grid base on user 
> choosen?
>
> thanks and best regards,
> stifan
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-03 Thread Seth J
Thanks, Leonel!  Looking forward to it ...

On Thursday, August 3, 2017 at 1:24:08 PM UTC-4, Leonel Câmara wrote:
>
> Seth that 2.15.2 bug has been fixed in trunk. Please wait for 2.15.3
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-03 Thread Leonel Câmara
Seth that 2.15.2 bug has been fixed in trunk. Please wait for 2.15.3

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-03 Thread Seth J
And it appears to be broken:

web2py™ Version 2.15.2-stable+timestamp.2017.07.19.12.18.41
Python Python 2.7.10: C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.

Traceback (most recent call last):
  File ".\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
  File "C:/inetpub/wwwroot/applications/CongressionalOfficeDev/models/db.py" 
,
 line 133, in 
migrate=settings.migrate)
  File "C:\inetpub\wwwroot\gluon\packages\dal\pydal\base.py", line 587, in 
define_table
table = self.lazy_define_table(tablename, *fields, **args)
  File "C:\inetpub\wwwroot\gluon\packages\dal\pydal\base.py", line 596, in 
lazy_define_table
fields = list(fields) + [f.clone() for f in common_fields]
AttributeError: 'Table' object has no attribute 'clone'


On Thursday, August 3, 2017 at 12:46:13 PM UTC-4, Seth J wrote:
>
> We're using 2.14.5 version of web2py so far.  Let me update one of our 
> dev servers and see if that solves the issue.  Thanks, Anthony!!!
>
> On Thursday, August 3, 2017 at 12:30:11 PM UTC-4, Anthony wrote:
>>
>> Also, what version of web2py are you using? Looking at the code, it 
>> appears this issue might be resolved in the current version of the DAL (it 
>> now generates all the fields to be updated *before *call the 
>> _before_update callbacks, which should result in the archive record being 
>> generated due to the new values for modified_on and modified_by).
>>
>> Anthony
>>
>> On Thursday, August 3, 2017 at 12:25:20 PM UTC-4, Anthony wrote:
>>>
>>> The problem is that archiving is handled via a _before_update callback, 
>>> which (a) only receives the fields that are explicitly submitted with the 
>>> form (i.e., not the modified_on and modified_by fields) and (b) archives 
>>> only if the submitted fields differ from those in the original record. The 
>>> modified_on and modified_by values, on the other hand, are not updated 
>>> until after the _before_update callback is called.
>>>
>>> To avoid the behavior, I think you will have to manually check whether 
>>> the submitted fields differ from the original record and then either (a) 
>>> temporarily changed the "update" attribute of the modified_on and 
>>> modified_by fields so their values are not actually updated or (b) 
>>> explicitly add the modified_on and modified_by fields to the form vars so 
>>> the archive record creation will be triggered.
>>>
>>> Anthony
>>>
>>> On Wednesday, August 2, 2017 at 12:45:48 PM UTC-4, Seth J wrote:

 Quick question, guys.  I've noticed that when record is edited in a 
 grid and no changes are made to it when hitting 'Submit' no entry is made 
 into a corresponding archive table.  However, fields "modified on" and 
 "modified by" are adjusted according to a user who submitted a change.  Is 
 there way to either not change the latter fields or put an entry in an 
 archive table reflecting previous state?  
 It becomes a little bit misleading and hard to proof that people have 
 not made any changes to the record when their name appears as an editor of 
 the field.  Thanks!

>>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-03 Thread Seth J
We're using 2.14.5 version of web2py so far.  Let me update one of our dev 
servers and see if that solves the issue.  Thanks, Anthony!!!

On Thursday, August 3, 2017 at 12:30:11 PM UTC-4, Anthony wrote:
>
> Also, what version of web2py are you using? Looking at the code, it 
> appears this issue might be resolved in the current version of the DAL (it 
> now generates all the fields to be updated *before *call the 
> _before_update callbacks, which should result in the archive record being 
> generated due to the new values for modified_on and modified_by).
>
> Anthony
>
> On Thursday, August 3, 2017 at 12:25:20 PM UTC-4, Anthony wrote:
>>
>> The problem is that archiving is handled via a _before_update callback, 
>> which (a) only receives the fields that are explicitly submitted with the 
>> form (i.e., not the modified_on and modified_by fields) and (b) archives 
>> only if the submitted fields differ from those in the original record. The 
>> modified_on and modified_by values, on the other hand, are not updated 
>> until after the _before_update callback is called.
>>
>> To avoid the behavior, I think you will have to manually check whether 
>> the submitted fields differ from the original record and then either (a) 
>> temporarily changed the "update" attribute of the modified_on and 
>> modified_by fields so their values are not actually updated or (b) 
>> explicitly add the modified_on and modified_by fields to the form vars so 
>> the archive record creation will be triggered.
>>
>> Anthony
>>
>> On Wednesday, August 2, 2017 at 12:45:48 PM UTC-4, Seth J wrote:
>>>
>>> Quick question, guys.  I've noticed that when record is edited in a grid 
>>> and no changes are made to it when hitting 'Submit' no entry is made into a 
>>> corresponding archive table.  However, fields "modified on" and "modified 
>>> by" are adjusted according to a user who submitted a change.  Is there way 
>>> to either not change the latter fields or put an entry in an archive table 
>>> reflecting previous state?  
>>> It becomes a little bit misleading and hard to proof that people have 
>>> not made any changes to the record when their name appears as an editor of 
>>> the field.  Thanks!
>>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-03 Thread Anthony
Also, what version of web2py are you using? Looking at the code, it appears 
this issue might be resolved in the current version of the DAL (it now 
generates all the fields to be updated *before *call the _before_update 
callbacks, which should result in the archive record being generated due to 
the new values for modified_on and modified_by).

Anthony

On Thursday, August 3, 2017 at 12:25:20 PM UTC-4, Anthony wrote:
>
> The problem is that archiving is handled via a _before_update callback, 
> which (a) only receives the fields that are explicitly submitted with the 
> form (i.e., not the modified_on and modified_by fields) and (b) archives 
> only if the submitted fields differ from those in the original record. The 
> modified_on and modified_by values, on the other hand, are not updated 
> until after the _before_update callback is called.
>
> To avoid the behavior, I think you will have to manually check whether the 
> submitted fields differ from the original record and then either (a) 
> temporarily changed the "update" attribute of the modified_on and 
> modified_by fields so their values are not actually updated or (b) 
> explicitly add the modified_on and modified_by fields to the form vars so 
> the archive record creation will be triggered.
>
> Anthony
>
> On Wednesday, August 2, 2017 at 12:45:48 PM UTC-4, Seth J wrote:
>>
>> Quick question, guys.  I've noticed that when record is edited in a grid 
>> and no changes are made to it when hitting 'Submit' no entry is made into a 
>> corresponding archive table.  However, fields "modified on" and "modified 
>> by" are adjusted according to a user who submitted a change.  Is there way 
>> to either not change the latter fields or put an entry in an archive table 
>> reflecting previous state?  
>> It becomes a little bit misleading and hard to proof that people have not 
>> made any changes to the record when their name appears as an editor of the 
>> field.  Thanks!
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid edit behavior when no changes are made

2017-08-03 Thread Anthony
The problem is that archiving is handled via a _before_update callback, 
which (a) only receives the fields that are explicitly submitted with the 
form (i.e., not the modified_on and modified_by fields) and (b) archives 
only if the submitted fields differ from those in the original record. The 
modified_on and modified_by values, on the other hand, are not updated 
until after the _before_update callback is called.

To avoid the behavior, I think you will have to manually check whether the 
submitted fields differ from the original record and then either (a) 
temporarily changed the "update" attribute of the modified_on and 
modified_by fields so their values are not actually updated or (b) 
explicitly add the modified_on and modified_by fields to the form vars so 
the archive record creation will be triggered.

Anthony

On Wednesday, August 2, 2017 at 12:45:48 PM UTC-4, Seth J wrote:
>
> Quick question, guys.  I've noticed that when record is edited in a grid 
> and no changes are made to it when hitting 'Submit' no entry is made into a 
> corresponding archive table.  However, fields "modified on" and "modified 
> by" are adjusted according to a user who submitted a change.  Is there way 
> to either not change the latter fields or put an entry in an archive table 
> reflecting previous state?  
> It becomes a little bit misleading and hard to proof that people have not 
> made any changes to the record when their name appears as an editor of the 
> field.  Thanks!
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid for data entry

2017-07-24 Thread Nico de Groot
Looks like you specify the left relation also in the select clause. Debugging 
tip: you can use _select() to see the SQL generated by the DAL. 
To get answers in the forum, it helps if you convert your question to an 
minimal example using easy to grasp tablenames and relations.

Nico de Groot 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid for data entry

2017-07-24 Thread T.R.Rajkumar
Any ideas?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid - limit searches to specified fields not whole tables

2017-07-07 Thread 'Matthew J Watts' via web2py-users
Ok thanks Antony i'll look into it, this looks like it could take some 
time!!

On Friday, July 7, 2017 at 2:42:37 PM UTC+2, Matthew J Watts wrote:
>
> Hi all
>
>  
>
> I’m having problems trying to tailor the grid to my needs
>
> I've set up a grid to query my db and it retrieves the data successfully, 
> great!
>
>  
>
> Example: def gridquery():
>
> grid = SQLFORM.grid((db.MAIN.TaxonID == db.TAXON.TaxonID), field_id = 
> db.MAIN.MainID, fields=[db.TAXON.TaxonName, db.TAXON.CommonName, 
> db.TAXON.TaxonomicPhylum])
>
> return locals() 
>
>  
>
> However, the search box contains all of the columns in all of the 
> connected tables.  I want to limit the searches only to the fields i have 
> specified e.g. 'fields=[db.TAXON.TaxonName, db.TAXON.CommonName, 
> db.TAXON.TaxonomicPhylum])'. 
>
>  
>
> 1.  I've tried to do a few things i.e.  setting the unwanted search 
> fields to 'writable = False & readable = False' 
>
> 2.   also tried this method [setattr(f, 'readable', False) for f in 
> mydb if f.name not in ('mydb.field')]
>
>  
>
> However, this limits the query results - i want to include all the tables 
> fields in the query results, just not in the searches. 
>
>  
>
> Does anyone have any suggestions? As I understand I might need to build a 
> custom widget, at my current level this seems rather complicated,is there a 
> simpler work around?. 
>
>  
>
> Thanks!
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid - limit searches to specified fields not whole tables

2017-07-07 Thread Anthony
I think you'll need a custom search widget and/or search function (the 
latter via the "searchable" argument). For details on how the current 
default search widget is constructed, see 
https://github.com/web2py/web2py/blob/89832479fccf6bb2d0ef19427bff2ee7f5347807/gluon/sqlhtml.py#L2618.
 
Note, it is built based on the SQLFORM.search_menu static method.

Feel free to open an issue or make a pull request.

Anthony

On Friday, July 7, 2017 at 8:42:37 AM UTC-4, Matthew J Watts wrote:
>
> Hi all
>
>  
>
> I’m having problems trying to tailor the grid to my needs
>
> I've set up a grid to query my db and it retrieves the data successfully, 
> great!
>
>  
>
> Example: def gridquery():
>
> grid = SQLFORM.grid((db.MAIN.TaxonID == db.TAXON.TaxonID), field_id = 
> db.MAIN.MainID, fields=[db.TAXON.TaxonName, db.TAXON.CommonName, 
> db.TAXON.TaxonomicPhylum])
>
> return locals() 
>
>  
>
> However, the search box contains all of the columns in all of the 
> connected tables.  I want to limit the searches only to the fields i have 
> specified e.g. 'fields=[db.TAXON.TaxonName, db.TAXON.CommonName, 
> db.TAXON.TaxonomicPhylum])'. 
>
>  
>
> 1.  I've tried to do a few things i.e.  setting the unwanted search 
> fields to 'writable = False & readable = False' 
>
> 2.   also tried this method [setattr(f, 'readable', False) for f in 
> mydb if f.name not in ('mydb.field')]
>
>  
>
> However, this limits the query results - i want to include all the tables 
> fields in the query results, just not in the searches. 
>
>  
>
> Does anyone have any suggestions? As I understand I might need to build a 
> custom widget, at my current level this seems rather complicated,is there a 
> simpler work around?. 
>
>  
>
> Thanks!
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-06 Thread T.R.Rajkumar
Thanks a lot icodk. Now I am able to change the text of buttons.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-06 Thread icodk
Sorry in your case it is
form[1][0][2][0]="Som text"

This will replace the text in the DOM element of the serialized form 
returned by the call to SQLFORM.smartgrid
Please note that the indexes (1,0,2,0) I used above can be different in 
your case. To find out start by printing the element to the console, then 
you can change the  indexes to get the button text.
For more info please see:
http://web2py.com/books/default/chapter/29/05/the-views#Server-side-DOM-and-parsing

On Tuesday, June 6, 2017 at 6:20:29 AM UTC+2, T.R.Rajkumar wrote:
>
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-05 Thread T.R.Rajkumar
Thanks icodk for the code. But I do not understand grid[1][0][2][0]. What 
is that? Could you pl. tell me. Thank you once again.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-05 Thread icodk
Code example:
else: #person grid
personRow = db(db.person.id == request.args[-1]).select()[0]
title = T("cars owned by :") + personRow.name
addBtn = T("Add new car for: ") + carRow.name
if toCreate:
grid[1][0][2][0] =addBtn



On Monday, June 5, 2017 at 11:47:15 AM UTC+2, T.R.Rajkumar wrote:
>
> Thanks icodk. You  said The last part is after the call to 
> SQLFORM.smartgrid. Here you can manipulate the serialized HTML data by for 
> example changing the "+Add record" text to "+Add person" in the  auto 
> generated button 
>
> I would like to know how you manipulate the html in controller as above 
> for changing the button text. 
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-05 Thread T.R.Rajkumar
Thanks icodk. You  said The last part is after the call to 
SQLFORM.smartgrid. Here you can manipulate the serialized HTML data by for 
example changing the "+Add record" text to "+Add person" in the  auto 
generated button 

I would like to know how you manipulate the html in controller as above for 
changing the button text. 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-05 Thread T.R.Rajkumar
Yes, Anthony. It now works. Thank you for your valuable time.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-03 Thread Anthony
Oops, sorry, for some reason I wrapped the labels dict in a list -- should 
be:

formargs={'amc_master': dict(labels={'lrrflg': 'Rate Revision'}),
  'amc_details': dict(labels={'qty': 'Quantity'})}


On Saturday, June 3, 2017 at 12:32:15 AM UTC-4, T.R.Rajkumar wrote:
>
> As said I did this in controller but there is no effect in either create 
> or edit forms of amc_master or amc_details. I added the closing parenthesis 
> for the first dict. Anything I miss?
>
> form = SQLFORM.smartgrid(db.amc_master,
>  linked_tables=['amc_details'],
>  user_signature=False,
>  fields=dict(amc_master=list_of_fields),
>  formstyle='table3cols',
>  headers=headers,
>  formargs={'amc_master': 
> dict(labels=[{'lrrflg': 'Rate Revision'}]),
>'amc_details': dict(labels=[{'qty': 
> 'Quantity'}])}
> )
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-03 Thread icodk
In a controller that shows a grid/smartgrid, I have three parts.The first 
part is before the call to the SQLFORM.smartgrid, then next is the call to 
SQLFORM.smartgrid and the third part is after the call to SQLFORM.smartgrid.
In the first part I inspect the request.args to figure out what the grid is 
going to do. For example:
if 'edit' in request.args:
   db.person.email.writable=False
   db.person.street_address.label="where is your house"

This will prevent the user from editing the email in the edit form
If there are linked tables I can also detect it and prepare a title like:
"This is a list of cars owned by John Smith"
In general request.args is your friend. Print it out and see what 
information is there

The last part is after the call to SQLFORM.smartgrid. Here you can 
manipulate the serialized HTML data by for example changing the "+Add 
record" text to "+Add person" in the  auto generated button 

On Saturday, June 3, 2017 at 6:32:15 AM UTC+2, T.R.Rajkumar wrote:
>
> As said I did this in controller but there is no effect in either create 
> or edit forms of amc_master or amc_details. I added the closing parenthesis 
> for the first dict. Anything I miss?
>
> form = SQLFORM.smartgrid(db.amc_master,
>  linked_tables=['amc_details'],
>  user_signature=False,
>  fields=dict(amc_master=list_of_fields),
>  formstyle='table3cols',
>  headers=headers,
>  formargs={'amc_master': 
> dict(labels=[{'lrrflg': 'Rate Revision'}]),
>'amc_details': dict(labels=[{'qty': 
> 'Quantity'}])}
> )
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-02 Thread T.R.Rajkumar
As said I did this in controller but there is no effect in either create or 
edit forms of amc_master or amc_details. I added the closing parenthesis 
for the first dict. Anything I miss?

form = SQLFORM.smartgrid(db.amc_master,
 linked_tables=['amc_details'],
 user_signature=False,
 fields=dict(amc_master=list_of_fields),
 formstyle='table3cols',
 headers=headers,
 formargs={'amc_master': 
dict(labels=[{'lrrflg': 'Rate Revision'}]),
   'amc_details': dict(labels=[{'qty': 
'Quantity'}])}
)

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-02 Thread Anthony
Instead of:

editargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
amc_details={'qty':'Quantity'})}

Try:

formargs={'amc_master': dict(labels=[{'lrrflg': 'Rate Revision'}],
  'amc_details': dict(labels=[{'qty': 'Quantity'}])}

Anthony

On Friday, June 2, 2017 at 1:31:24 AM UTC-4, T.R.Rajkumar wrote:
>
> You've got it backwards -- the top-level keys of the editargs and 
> createargs parameters should be the table names, with the nested 
> dictionaries holding the actual SQLFORM arguments.
>
> I am not familiar with the syntax. Can you pl. elaborate with some actual 
> code. Thanks Anthony.
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-01 Thread T.R.Rajkumar
You've got it backwards -- the top-level keys of the editargs and 
createargs parameters should be the table names, with the nested 
dictionaries holding the actual SQLFORM arguments.

I am not familiar with the syntax. Can you pl. elaborate with some actual 
code. Thanks Anthony.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-01 Thread Anthony
On Thursday, June 1, 2017 at 5:35:14 AM UTC-4, T.R.Rajkumar wrote:
>
> For a smartgrid I am doing this.
> form = SQLFORM.smartgrid(db.amc_master,
>  linked_tables=['amc_details'],
>  user_signature=False,
>  fields=dict(amc_master=list_of_fields),
>  formstyle='table3cols',
>  headers=headers,
>  
> editargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
>  
> amc_details={'qty':'Quantity'})},
>  
> createargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
>  
> amc_details={'qty':'Quantity'})})
>

You've got it backwards -- the top-level keys of the editargs and 
createargs parameters should be the table names, with the nested 
dictionaries holding the actual SQLFORM arguments.

Also, if you are using the same labels for create and edit forms, you can 
instead just use "formargs", which will apply to all forms.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-01 Thread Jim S
Set the 'label' attribute on the individual fields that will be displayed 
before your call to SQLFORM.smartgrid()

Ex:  db.customer.first_name.label = 'First Name'

-Jim

On Thursday, June 1, 2017 at 4:35:14 AM UTC-5, T.R.Rajkumar wrote:
>
> For a smartgrid I am doing this.
> form = SQLFORM.smartgrid(db.amc_master,
>  linked_tables=['amc_details'],
>  user_signature=False,
>  fields=dict(amc_master=list_of_fields),
>  formstyle='table3cols',
>  headers=headers,
>  
> editargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
>  
> amc_details={'qty':'Quantity'})},
>  
> createargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
>  
> amc_details={'qty':'Quantity'})})
>
> But I see no effect in labels of edit/create forms. I dont know how to do 
> that. Pl. help.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid add/edit form label

2017-06-01 Thread T.R.Rajkumar
For a smartgrid I am doing this.
form = SQLFORM.smartgrid(db.amc_master,
 linked_tables=['amc_details'],
 user_signature=False,
 fields=dict(amc_master=list_of_fields),
 formstyle='table3cols',
 headers=headers,
 
editargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
 
amc_details={'qty':'Quantity'})},
 
createargs={'labels':dict(amc_master={'lrrflg':'Rate Revision'},
 
amc_details={'qty':'Quantity'})})

But I see no effect in labels of edit/create forms. I dont know how to do 
that. Pl. help.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-31 Thread T.R.Rajkumar
Yes Anthony, with this the grid edit is OK.
[setattr(f, 'writable', False) for f in db.
amc_master
 if f.name not in ['id', 'amcdesc', 'amcmod', 'complndays']]

But how come it worked fine with postgresql without the id field setting?

Anyway thanks a lot for resolving the issue.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-31 Thread Anthony
On Wednesday, May 31, 2017 at 5:39:11 AM UTC-4, T.R.Rajkumar wrote:
>
> When I do SQLFORM.grid(db.amc_master) without setting any of the 
> readable/writable attributes the grid edit works fine. I am able to edit 
> and the form submits without errors. 
> Even with specifying the fields list grid edit works fine as the edit from 
> has all the fields of the table. 
> But when I set the  readable/writable attributes to filter the fields in 
> edit form the the error 42000 listed above occurs. 
>

I see the problem. By default, the "id" field is actually set to 
writable=True. It is excluded from SQLFORM database writes not because of 
its "writable" attribute but because the SQLFORM.accepts() code explicitly 
excludes the "id" field. However, the code at this line 

 
ends up including fields that are in the record by have writable=False. So, 
because your code sets writable=False for all fields except the three 
special fields you have identified, the "id" field ends up getting 
writable=False, which forces it to be included in the database update. To 
fix this, the following should work:

[setattr(f, 'writable', False) for f in db.amc_master
 if f.name not in ['id', 'amcdesc', 'amcmod', 'complndays']]

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-31 Thread Jim S
Have you tried adding 'id' to your editable field list?

[setattr(f, 'writable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays', 'id']]

-Jim

On Wednesday, May 31, 2017 at 4:39:11 AM UTC-5, T.R.Rajkumar wrote:
>
> When I do SQLFORM.grid(db.amc_master) without setting any of the 
> readable/writable attributes the grid edit works fine. I am able to edit 
> and the form submits without errors. 
> Even with specifying the fields list grid edit works fine as the edit from 
> has all the fields of the table. 
> But when I set the  readable/writable attributes to filter the fields in 
> edit form the the error 42000 listed above occurs. 
> Thank you Anthony for the test guidance. 
> How to go about now?
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-31 Thread T.R.Rajkumar
When I do SQLFORM.grid(db.amc_master) without setting any of the 
readable/writable attributes the grid edit works fine. I am able to edit 
and the form submits without errors. 
Even with specifying the fields list grid edit works fine as the edit from 
has all the fields of the table. 
But when I set the  readable/writable attributes to filter the fields in 
edit form the the error 42000 listed above occurs. 
Thank you Anthony for the test guidance. 
How to go about now?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-30 Thread Anthony
The "id" field is not writable in SQLFORMs, so the grid/SQLFORM do not 
include that field in update SQL queries. Does the "id" field actually 
appear as writable in your forms? What happens if you just do 
SQLFORM.grid(db.amc_master) without specifying the fields list or setting 
any of the readable/writable attributes?

On Wednesday, May 24, 2017 at 5:08:56 AM UTC-4, T.R.Rajkumar wrote:
>
> I have this in model.
> db.define_table('amc_master',
> Field('amcno', type='string',length=10,
> required='True',notnull='True',requires=IS_LENGTH(10)),
> Field('unitid',type='string',length=3,notnull='True'),
> Field('amcdesc', 
> type='string',length=512,required='True',notnull='True'),
> Field('estval', type='decimal(18,2)'),
> Field('supcflg', type='string', length=1),
> Field('supcval',type='decimal(18,2)'),
> Field('netestval',type='decimal(18,2)'),
> Field('bidmethod',type='string',length=3),
> Field('capbud',type='string',length=1),
> Field('amcmod',type='string',length=3),
> Field('lrrflg',type='string',length=1),
> Field('insflg',type='string',length=1),
> Field('stflg',type='string',length=1),
> Field('phwflg',type='string',length=1),
> Field('contyp',type='string',length=3),
> Field('rfact',type='decimal(18,2)'),
> Field('qfact',type='decimal(18,2)'),
> Field('emdamt',type='decimal(18,2)'),
> Field('doccharge',type='decimal(18,2)'),
> Field('divn',type='string',length=3),
> Field('subdivn',type='string',length=2),
> Field('cflg',type='string',length=1),
> Field('statflg',type='string',length=3),
> Field('appauthority',type='string',length=16),
> Field('accappddt',type='datetime'),
> Field('iewappddt',type='datetime'),
> Field('complndays',type='integer'),
> Field('examcno',type='string',length=10),
> Field('consoldamcstr',type='string',length=70),
> Field('isconsold',type='string',length=1),
> Field('estonprovn',type='decimal(18,2)'),
> Field('totest',type='decimal(18,2)'),
> 
> Field('update_uid','string',length=6,required='True',notnull='True'),
> 
> Field('update_dt','datetime',required='True',notnull='True')
> )
>
> in controller i have this
>
> def newamcmaster():
> list_of_fields = 
> [db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
> [setattr(f, 'readable', False) for f in db.amc_master if f.name not 
> in ['amcdesc','amcmod','complndays']]
> [setattr(f, 'writable', False) for f in db.amc_master if f.name not 
> in ['amcdesc','amcmod','complndays']]
> grid = 
> SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
> return locals()
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-30 Thread isi_jca
T.R.Rajkumar

Try setting this value:

*field_id* must be the field of the table to be used as ID, for example 
db.mytable.id. This is useful when the grid query is a join of several 
tables. Any action button on the grid(add record, view, edit, delete) will 
work over db.mytable.


Regards.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-29 Thread T.R.Rajkumar
I don't know why there is no response from anyone in the group. Is the post 
not clear? Thanks 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-25 Thread T.R.Rajkumar
I googled and saw this https://www.drupal.org/node/2342699 where it is 
stated that SqlContentEntityStorage::mapToStorageRecord sends update 
statements that includes IDENTITY fields that need to be updated, such as: 
UPDATE xxx SET nid = 1, property0 = :value0 WHERE nid = 1;. This is not 
supported in SQL Server because although there is no actual update 
happening it is explicitly telling the database engine that you wish to 
perform an update.

and here https://www.drupal.org/node/2090251  it is said The underlying 
problem is that MySQL accepts identity updates (when there are no changes) 
but Sql Server being properly designed complains with this bad practice.

Is this the issue in web2py also.
 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-24 Thread T.R.Rajkumar
When I connect to postgresql the same model the grid edit form submits 
without error. Is this to do with pyodbc?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-24 Thread T.R.Rajkumar
I have this in model.
db.define_table('amc_master',
Field('amcno', type='string',length=10,
required='True',notnull='True',requires=IS_LENGTH(10)),
Field('unitid',type='string',length=3,notnull='True'),
Field('amcdesc', 
type='string',length=512,required='True',notnull='True'),
Field('estval', type='decimal(18,2)'),
Field('supcflg', type='string', length=1),
Field('supcval',type='decimal(18,2)'),
Field('netestval',type='decimal(18,2)'),
Field('bidmethod',type='string',length=3),
Field('capbud',type='string',length=1),
Field('amcmod',type='string',length=3),
Field('lrrflg',type='string',length=1),
Field('insflg',type='string',length=1),
Field('stflg',type='string',length=1),
Field('phwflg',type='string',length=1),
Field('contyp',type='string',length=3),
Field('rfact',type='decimal(18,2)'),
Field('qfact',type='decimal(18,2)'),
Field('emdamt',type='decimal(18,2)'),
Field('doccharge',type='decimal(18,2)'),
Field('divn',type='string',length=3),
Field('subdivn',type='string',length=2),
Field('cflg',type='string',length=1),
Field('statflg',type='string',length=3),
Field('appauthority',type='string',length=16),
Field('accappddt',type='datetime'),
Field('iewappddt',type='datetime'),
Field('complndays',type='integer'),
Field('examcno',type='string',length=10),
Field('consoldamcstr',type='string',length=70),
Field('isconsold',type='string',length=1),
Field('estonprovn',type='decimal(18,2)'),
Field('totest',type='decimal(18,2)'),

Field('update_uid','string',length=6,required='True',notnull='True'),
Field('update_dt','datetime',required='True',notnull='True')
)

in controller i have this

def newamcmaster():
list_of_fields = 
[db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
[setattr(f, 'readable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
[setattr(f, 'writable', False) for f in db.amc_master if f.name not in 
['amcdesc','amcmod','complndays']]
grid = 
SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
return locals()

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-24 Thread Dave S


On Tuesday, May 23, 2017 at 11:28:29 PM UTC-7, T.R.Rajkumar wrote:
>
> Why is DAL trying to update id column in grid edit form submission.
>

I think we need your model file to have much idea.

/dps
 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid oncreate

2017-05-23 Thread T.R.Rajkumar
First, why use db.executesql rather than a regular DAL query? Second, you 
should move the call to get_new_amcno to the controller function where you 
need to do this insert and set the defaults there -- otherwise, you are 
doing this database query on every single request to the app, even all the 
requests where it is not needed. To set the defaults after the table 
definition, just do:

db.mytable.myfield.default = 'some value'

Anthony

Thanks Anthony for the guidance. I have moved get_new_amcno to the 
controller. I use executesql for calling stored procedure which gives the 
coined amcno as result. For coining of amcno it uses other tables like 
amcdivn, amcsection which I have not defined in my model because I never am 
to do any crud on these tables. So I thought an sp would do fine. Is that 
approach OK? Regards.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid edit

2017-05-23 Thread T.R.Rajkumar
Why is DAL trying to update id column in grid edit form submission.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid oncreate

2017-05-23 Thread Anthony
On Tuesday, May 23, 2017 at 7:40:13 AM UTC-4, T.R.Rajkumar wrote:
>
> I solved the issue as hinted by Anthony and Dave S. 
>
> In model db.py I added this function
>
> def get_new_amcno():
> rows =  db.executesql("exec gen_amcno_new @ucod = 
> ?,@divcod=?,@sec=?",placeholders=([session.unit,session.divn, 
> session.sec]),as_dict=True) 
> for i in rows:
> amcno = i['amcno']
> return amcno
>
> And in table definition for amcno I set the default = get_new_amcno
>

First, why use db.executesql rather than a regular DAL query? Second, you 
should move the call to get_new_amcno to the controller function where you 
need to do this insert and set the defaults there -- otherwise, you are 
doing this database query on every single request to the app, even all the 
requests where it is not needed. To set the defaults after the table 
definition, just do:

db.mytable.myfield.default = 'some value'

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid oncreate

2017-05-23 Thread T.R.Rajkumar
I solved the issue as hinted by Anthony and Dave S. 

In model db.py I added this function

def get_new_amcno():
rows =  db.executesql("exec gen_amcno_new @ucod = 
?,@divcod=?,@sec=?",placeholders=([session.unit,session.divn, 
session.sec]),as_dict=True) 
for i in rows:
amcno = i['amcno']
return amcno

And in table definition for amcno I set the default = get_new_amcno

Now this inserts the new coined amcno in the field.

Thanks Anthony, Dave S

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid oncreate

2017-05-23 Thread T.R.Rajkumar
The values are for the user. So as soon the user logs in I can find the 
values.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid oncreate

2017-05-22 Thread Dave S


On Monday, May 22, 2017 at 9:28:10 PM UTC-7, T.R.Rajkumar wrote:
>
> The amcno is coined based on the user, his working division, section and 
> previous amcno. Also the update_uid is the user who has logged in. As said 
> may be the update_dt can be set to default request.now. But how to set 
> others which requires calculation?
>
>
At what point do you know the values required for the calculations?

/dps

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid oncreate

2017-05-22 Thread T.R.Rajkumar
The amcno is coined based on the user, his working division, section and 
previous amcno. Also the update_uid is the user who has logged in. As said 
may be the update_dt can be set to default request.now. But how to set 
others which requires calculation?


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid oncreate

2017-05-22 Thread Anthony
Specify the "default" argument for the fields you want filled in 
automatically by the DAL.

Anthony

On Monday, May 22, 2017 at 7:21:02 AM UTC-4, T.R.Rajkumar wrote:
>
> I have this in model.
> db.define_table('amc_master',
> Field('amcno', 
> type='string',length=10,required='True',notnull='True',requires=IS_LENGTH(10)),
> Field('unitid',type='string',length=3,notnull='True'),
> Field('amcdesc', 
> type='string',length=512,required='True',notnull='True'),
> Field('estval', type='decimal(18,2)'),
> Field('supcflg', type='string', length=1),
> Field('supcval',type='decimal(18,2)'),
> Field('netestval',type='decimal(18,2)'),
> Field('bidmethod',type='string',length=3),
> Field('capbud',type='string',length=1),
> Field('amcmod',type='string',length=3),
> Field('lrrflg',type='string',length=1),
> Field('insflg',type='string',length=1),
> Field('stflg',type='string',length=1),
> Field('phwflg',type='string',length=1),
> Field('contyp',type='string',length=3),
> Field('rfact',type='decimal(18,2)'),
> Field('qfact',type='decimal(18,2)'),
> Field('emdamt',type='decimal(18,2)'),
> Field('doccharge',type='decimal(18,2)'),
> Field('divn',type='string',length=3),
> Field('subdivn',type='string',length=2),
> Field('cflg',type='string',length=1),
> Field('statflg',type='string',length=3),
> Field('appauthority',type='string',length=16),
> Field('accappddt',type='datetime'),
> Field('iewappddt',type='datetime'),
> Field('complndays',type='integer'),
> Field('examcno',type='string',length=10),
> Field('consoldamcstr',type='string',length=70),
> Field('isconsold',type='string',length=1),
> Field('estonprovn',type='decimal(18,2)'),
> Field('totest',type='decimal(18,2)'),
> 
> Field('update_uid','string',length=6,required='True',notnull='True'),
> 
> Field('update_dt','datetime',required='True',notnull='True')
> )
>
> in controller i have this
>
> def newamcmaster():
> list_of_fields = 
> [db.amc_master.amcdesc,db.amc_master.amcmod,db.amc_master.complndays]
> [setattr(f, 'readable', False) for f in db.amc_master if f.name not 
> in ['amcdesc','amcmod','complndays']]
> [setattr(f, 'writable', False) for f in db.amc_master if f.name not 
> in ['amcdesc','amcmod','complndays']]
> grid = 
> SQLFORM.grid(db.amc_master,user_signature=False,fields=list_of_fields,oncreate=create_new_amc)
> return locals()
>
> when I call http://127.0.0.1:8000/web_ocms/amc/newamcmaster the grid 
> displays the three fields amcdesc, amcmod, complndays.
>
> When addrecord is clicked it displays form with the above three fields 
> correctly. 
>
> Now the amcno,update_uid, update_dt fields are mandatory but has to be 
> filled by the server. The user is not to input these fields.
>
> How to insert a new record with user inputting the three fields and other 
> required fields are filled in oncreate callback or some other methods. Pl. 
> help. Regards.
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid exportclasses not work in recent version

2017-01-04 Thread Andrea Fae'
Hello,
I solved with this 

headers={'sede.nome':'Struttura','sede.is_active':'Attivo'}
exportcls = dict(csv_with_hidden_cols=False, xml=True, html=False, 
json=False, tsv_with_hidden_cols=False, tsv=False)
grid = 
SQLFORM.smartgrid(db.sede,linked_tables=['uo','pc'],fields=[db.sede.nome, 
db.sede.is_active, db.uo.nome,db.pc.seriale,db.pc.nome],headers=headers, 
details=True, editable=True, deletable=False, 
maxtextlength=40,exportclasses=dict(sede = exportcls,uo = exportcls, pc = 
exportcls),onupdate=auth.archive)

Now only csv and xml export are visible. 
But I have another problemheaders not working

Il giorno martedì 3 gennaio 2017 18:26:14 UTC+1, Anthony ha scritto:
>
> On Tuesday, January 3, 2017 at 11:02:22 AM UTC-5, Andrea Fae' wrote:
>>
>> What does it mean exactly?
>>
>> I have this but in the view export is exposed totally... why?
>>
>
> What do you mean "export is exposed totally"? What problem are you having?
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid exportclasses not work in recent version

2017-01-03 Thread Anthony
On Tuesday, January 3, 2017 at 11:02:22 AM UTC-5, Andrea Fae' wrote:
>
> What does it mean exactly?
>
> I have this but in the view export is exposed totally... why?
>

What do you mean "export is exposed totally"? What problem are you having?

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: grid exportclasses not work in recent version

2017-01-03 Thread Andrea Fae'
What does it mean exactly?

I have this but in the view export is exposed totally... why?
grid = 
SQLFORM.smartgrid(db.sede,linked_tables=['uo'],fields=[db.sede.nome,db.uo.nome],headers={'sede.nome':'Nome
 
Struttura'},details=True, editable=True, deletable=False, 
maxtextlength=40,csv=True, exportclasses=dict(csv_with_hidden_cols=False, 
csv=True, xml=False, html=False, json=False, tsv_with_hidden_cols=False, 
tsv=False))

Il giorno venerdì 17 giugno 2016 04:29:21 UTC+2, Anthony ha scritto:
>
> Yes, an issue has already been filed. For now, you must use a dictionary 
> with a key for each table.

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid export csv

2016-10-24 Thread Niphlod
never ever pull web2py AND pydal master's  and merge (unless you really 
know what you're doing). When using "master", at most, use web2py's one, 
which has the correct pointers to pydal's specific commits.

Any commit later than 15aug should work fine ^_^

On Friday, October 21, 2016 at 10:54:31 PM UTC+2, Bartosz Baranowski wrote:
>
> Niphlod,
>
> I am using latest web2py and pydal from master branches. Any idea where is 
> the fix? Could you please direct me to the commit?
>
> W dniu środa, 3 sierpnia 2016 12:51:56 UTC-7 użytkownik Niphlod napisał:
>>
>> should be already fixed on master, anyway if you're in a hurry, set 
>> entity_quoring=False on the DAL line to make it work again (long story 
>> short, DAL now quotes everything by default and not every cog in the wheel 
>> was expecting that)
>>
>> On Monday, August 1, 2016 at 1:51:54 PM UTC+2, Kostas M wrote:
>>>
>>> I have the same problem with the CSV, HTML, TSV export buttons. The 
>>> Ticket for the CSV is pasted below. The problem at least with the csv 
>>> export button seems to be with the REGEX_TABLE_DOT_FIELD. Normally, this 
>>> constant is defined in regex.py as:
>>>
>>> REGEX_TABLE_DOT_FIELD = re.compile('^(\w+)\.([^.]+)$')
>>>
>>> and previous web2py versions used it.
>>>
>>> However, now it takes the REGEX_TABLE_DOT_FIELD definition from the 
>>> base.py:
>>>
>>> obj.REGEX_TABLE_DOT_FIELD = re.compile(
>>> r'^' + quot % regex_ent + r'\.' + quot % regex_ent + r'$')
>>>
>>>
>>> which is a totally different regex and it doesn't match with the table 
>>> field names...
>>>
>>>
>>> Ticket ID 
>>>
>>> 127.0.0.1.2016-08-01.14-36-35.a05a56c8-5b22-42c3-a3e3-385322b5f0fe
>>>  Version 
>>> web2py™ Version 2.14.5-stable+timestamp.2016.04.14.03.26.16 
>>> Python Python 2.7.6: /home/kmouts/Envs/prolims2_venv/bin/python2.7 
>>> (prefix: /home/kmouts/Envs/prolims2_venv) Traceback 
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>> 14.
>>> 15.
>>> 16.
>>> 17.
>>> 18.
>>> 19.
>>> 20.
>>> 21.
>>> 22.
>>>
>>> Traceback (most recent call last):
>>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/restricted.py", 
>>> line 227, in restricted
>>> exec ccode in environment
>>>   File 
>>> "/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
>>>  , 
>>> line 187, in 
>>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/globals.py", 
>>> line 417, in 
>>> self._caller = lambda f: f()
>>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/tools.py", line 
>>> 4258, in f
>>> return action(*a, **b)
>>>   File 
>>> "/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
>>>  , 
>>> line 49, in my_analyses
>>> exportclasses=dict(csv_with_hidden_cols=False, 
>>> tsv_with_hidden_cols=False)
>>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", 
>>> line 3102, in smartgrid
>>> user_signature=user_signature, **kwargs)
>>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", 
>>> line 2473, in grid
>>> raise HTTP(200, oExp.export(), **response.headers)
>>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", 
>>> line 3514, in export
>>> self.rows.export_to_csv_file(s, represent=True)
>>>   File 
>>> "/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
>>>  line 2446, in export_to_csv_file
>>> row.append(record._extra[col])
>>>   File 
>>> "/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
>>>  line 91, in __getattr__
>>> raise AttributeError
>>> AttributeError
>>>
>>>
>>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid export csv

2016-10-21 Thread Bartosz Baranowski
Niphlod,

I am using latest web2py and pydal from master branches. Any idea where is 
the fix? Could you please direct me to the commit?

W dniu środa, 3 sierpnia 2016 12:51:56 UTC-7 użytkownik Niphlod napisał:
>
> should be already fixed on master, anyway if you're in a hurry, set 
> entity_quoring=False on the DAL line to make it work again (long story 
> short, DAL now quotes everything by default and not every cog in the wheel 
> was expecting that)
>
> On Monday, August 1, 2016 at 1:51:54 PM UTC+2, Kostas M wrote:
>>
>> I have the same problem with the CSV, HTML, TSV export buttons. The 
>> Ticket for the CSV is pasted below. The problem at least with the csv 
>> export button seems to be with the REGEX_TABLE_DOT_FIELD. Normally, this 
>> constant is defined in regex.py as:
>>
>> REGEX_TABLE_DOT_FIELD = re.compile('^(\w+)\.([^.]+)$')
>>
>> and previous web2py versions used it.
>>
>> However, now it takes the REGEX_TABLE_DOT_FIELD definition from the 
>> base.py:
>>
>> obj.REGEX_TABLE_DOT_FIELD = re.compile(
>> r'^' + quot % regex_ent + r'\.' + quot % regex_ent + r'$')
>>
>>
>> which is a totally different regex and it doesn't match with the table 
>> field names...
>>
>>
>> Ticket ID 
>>
>> 127.0.0.1.2016-08-01.14-36-35.a05a56c8-5b22-42c3-a3e3-385322b5f0fe
>>  Version 
>> web2py™ Version 2.14.5-stable+timestamp.2016.04.14.03.26.16 
>> Python Python 2.7.6: /home/kmouts/Envs/prolims2_venv/bin/python2.7 
>> (prefix: /home/kmouts/Envs/prolims2_venv) Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>>
>> Traceback (most recent call last):
>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/restricted.py", 
>> line 227, in restricted
>> exec ccode in environment
>>   File 
>> "/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
>>  , 
>> line 187, in 
>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/globals.py", line 
>> 417, in 
>> self._caller = lambda f: f()
>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/tools.py", line 
>> 4258, in f
>> return action(*a, **b)
>>   File 
>> "/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
>>  , 
>> line 49, in my_analyses
>> exportclasses=dict(csv_with_hidden_cols=False, 
>> tsv_with_hidden_cols=False)
>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
>> 3102, in smartgrid
>> user_signature=user_signature, **kwargs)
>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
>> 2473, in grid
>> raise HTTP(200, oExp.export(), **response.headers)
>>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
>> 3514, in export
>> self.rows.export_to_csv_file(s, represent=True)
>>   File 
>> "/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
>>  line 2446, in export_to_csv_file
>> row.append(record._extra[col])
>>   File 
>> "/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
>>  line 91, in __getattr__
>> raise AttributeError
>> AttributeError
>>
>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid export csv

2016-08-04 Thread Kostas M

As you said, it works again now, by setting: entity_quoting=False

Thanks Niphlod!

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid export csv

2016-08-03 Thread Niphlod
should be already fixed on master, anyway if you're in a hurry, set 
entity_quoring=False on the DAL line to make it work again (long story 
short, DAL now quotes everything by default and not every cog in the wheel 
was expecting that)

On Monday, August 1, 2016 at 1:51:54 PM UTC+2, Kostas M wrote:
>
> I have the same problem with the CSV, HTML, TSV export buttons. The Ticket 
> for the CSV is pasted below. The problem at least with the csv export 
> button seems to be with the REGEX_TABLE_DOT_FIELD. Normally, this constant 
> is defined in regex.py as:
>
> REGEX_TABLE_DOT_FIELD = re.compile('^(\w+)\.([^.]+)$')
>
> and previous web2py versions used it.
>
> However, now it takes the REGEX_TABLE_DOT_FIELD definition from the 
> base.py:
>
> obj.REGEX_TABLE_DOT_FIELD = re.compile(
> r'^' + quot % regex_ent + r'\.' + quot % regex_ent + r'$')
>
>
> which is a totally different regex and it doesn't match with the table 
> field names...
>
>
> Ticket ID 
>
> 127.0.0.1.2016-08-01.14-36-35.a05a56c8-5b22-42c3-a3e3-385322b5f0fe
>  Version 
> web2py™ Version 2.14.5-stable+timestamp.2016.04.14.03.26.16 
> Python Python 2.7.6: /home/kmouts/Envs/prolims2_venv/bin/python2.7 
> (prefix: /home/kmouts/Envs/prolims2_venv) Traceback 
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
>
> Traceback (most recent call last):
>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/restricted.py", 
> line 227, in restricted
> exec ccode in environment
>   File 
> "/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
>  , 
> line 187, in 
>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/globals.py", line 
> 417, in 
> self._caller = lambda f: f()
>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/tools.py", line 
> 4258, in f
> return action(*a, **b)
>   File 
> "/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
>  , 
> line 49, in my_analyses
> exportclasses=dict(csv_with_hidden_cols=False, tsv_with_hidden_cols=False)
>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
> 3102, in smartgrid
> user_signature=user_signature, **kwargs)
>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
> 2473, in grid
> raise HTTP(200, oExp.export(), **response.headers)
>   File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
> 3514, in export
> self.rows.export_to_csv_file(s, represent=True)
>   File 
> "/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
>  line 2446, in export_to_csv_file
> row.append(record._extra[col])
>   File 
> "/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
>  line 91, in __getattr__
> raise AttributeError
> AttributeError
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid export csv

2016-08-01 Thread Kostas M
I have the same problem with the CSV, HTML, TSV export buttons. The Ticket 
for the CSV is pasted below. The problem at least with the csv export 
button seems to be with the REGEX_TABLE_DOT_FIELD. Normally, this constant 
is defined in regex.py as:

REGEX_TABLE_DOT_FIELD = re.compile('^(\w+)\.([^.]+)$')

and previous web2py versions used it.

However, now it takes the REGEX_TABLE_DOT_FIELD definition from the base.py:

obj.REGEX_TABLE_DOT_FIELD = re.compile(
r'^' + quot % regex_ent + r'\.' + quot % regex_ent + r'$')


which is a totally different regex and it doesn't much with the table field 
names...


Ticket ID 

127.0.0.1.2016-08-01.14-36-35.a05a56c8-5b22-42c3-a3e3-385322b5f0fe
 Version 
web2py™ Version 2.14.5-stable+timestamp.2016.04.14.03.26.16 
Python Python 2.7.6: /home/kmouts/Envs/prolims2_venv/bin/python2.7 (prefix: 
/home/kmouts/Envs/prolims2_venv) Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/restricted.py", line 
227, in restricted
exec ccode in environment
  File 
"/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
 , line 
187, in 
  File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/globals.py", line 
417, in 
self._caller = lambda f: f()
  File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/tools.py", line 
4258, in f
return action(*a, **b)
  File 
"/home/kmouts/PycharmProjects/prolims2/web2py/applications/prolims2/controllers/muser.py"
 , line 
49, in my_analyses
exportclasses=dict(csv_with_hidden_cols=False, tsv_with_hidden_cols=False)
  File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
3102, in smartgrid
user_signature=user_signature, **kwargs)
  File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
2473, in grid
raise HTTP(200, oExp.export(), **response.headers)
  File "/home/kmouts/PycharmProjects/prolims2/web2py/gluon/sqlhtml.py", line 
3514, in export
self.rows.export_to_csv_file(s, represent=True)
  File 
"/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
 line 2446, in export_to_csv_file
row.append(record._extra[col])
  File 
"/home/kmouts/Envs/prolims2_venv/local/lib/python2.7/site-packages/pydal/objects.py",
 line 91, in __getattr__
raise AttributeError
AttributeError


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid export csv

2016-08-01 Thread Ryan Hood

DB.PY

db.define_table('test',

Field('name', 'string', length=50, notnull=True),

Field('email', 'string', notnull=True),

format="%(name)s")

DEFAULT.PY

query=(db.test.id>0)

fields=[db.test.id,db.test.name,db.test.email]

forms=SQLFORM.grid(query=query, csv=True)

return dict(forms=forms)


I get the following error:
Version

web2py™ Version 2.14.5-stable+timestamp.2016.04.13.22.22.13
Python Python 2.7.9: C:\python27\python.exe (prefix: C:\python27)


Function argument list

(self=, 
k='_extra')


It appears to be looking for an _extra parameter?


Note: This happens for both CSV and TSV exports.


Please advise.


Thank you,

Ryan




On Sunday, July 31, 2016 at 2:33:19 AM UTC-4, Massimo Di Pierro wrote:
>
> You press the button. Is this not working? What happens? What you model? 
> What is your grid?
>
> On Friday, 29 July 2016 11:23:28 UTC-5, Ryan Hood wrote:
>>
>> How do you get the csv export to work in web2py grid? 
>>
>> NOTE: Working with web2py version 2.14.6 and 2.14.5
>>
>> Thank you,
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid export csv

2016-07-30 Thread Massimo Di Pierro
You press the button. Is this not working? What happens? What you model? 
What is your grid?

On Friday, 29 July 2016 11:23:28 UTC-5, Ryan Hood wrote:
>
> How do you get the csv export to work in web2py grid? 
>
> NOTE: Working with web2py version 2.14.6 and 2.14.5
>
> Thank you,
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid remove class date/datetime

2016-05-12 Thread isi_jca
Hello!!!

In my particular case, I wrote this code in my view:



jQuery('input#tmatrizlaboral_fecingreso').removeClass('date form-control'); 


Greetings.

El jueves, 12 de mayo de 2016, 9:45:07 (UTC-3), isi_jca escribió:
>
> Hi!!!
>
> Is possible to remove class date/datetime from form Grid?.
>
> Thanks 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID export broken for CSV but not for JSON

2016-02-13 Thread Niphlod
also, the grid relies on the id for other functions, it's always better to 
include it 

On Saturday, February 13, 2016 at 12:20:22 AM UTC+1, Anthony wrote:
>
> This can probably be improved, but the problem is that your grid does not 
> include all the fields needed by the "represent" function (i.e., it is 
> missing the "id" field). You could (a) re-write the represent so it doesn't 
> fail when the "id" field is missing, (b) use one of the "hidden column" 
> downloads instead, or (c) in the controller, check whether the request is 
> for an export (i.e, '_export_type' in request.vars), and include the "id" 
> field in that case.
>
> Unfortunately, these solutions mean you either won't have the 
> "represented" value in the CSV file (which you may not want anyway, as it 
> is an HTML anchor tag in this case), or you will have extra fields that you 
> otherwise might want excluded (in this case, the "id" field).
>
> Note, you can also use the "exportclasses" argument to provide your own 
> custom export class, and use something like option (c) above, but write the 
> export class so it excludes any columns you want to hide.
>
> Anthony
>
> On Friday, February 12, 2016 at 5:01:40 PM UTC-5, olivier hubert wrote:
>>
>>
>> I implemented a clone of Notifier application from Massimo.
>> If I try to export data from the grid via the grid bottom button I 
>> receive an error if I use export to CSV, HTML & TSV but not with JSON or 
>> XML.
>>
>> *default.py*
>> @auth.requires_login()
>> def tasks():
>> db.task.created_on.readable = True
>> db.task.created_by.readable = True
>> db.task.title.represent = lambda title, row:A(title, _href=URL(
>> 'view_task', args=row.id))
>> query = (db.task.assigned_to==me)|(db.task.created_by==me)
>> grid = SQLFORM.grid(query,
>> orderby=~db.task.modified_on,
>> create=False,
>> details=False,
>> editable=False,
>> deletable=lambda row: (row.created_by==me),
>> fields=[
>> db.task.status,
>> db.task.title,
>> db.task.created_on,
>> db.task.deadline,
>> db.task.created_by,
>> db.task.assigned_to
>> ])
>> return locals()
>>
>> *Traceback*
>>
>>  Traceback (most recent call last):
>>  File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 
>> 227, in restricted
>>  exec ccode in environment
>>  File 
>> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>>  
>> 
>> , line 134, in 
>>  File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, 
>> in 
>>  self._caller = lambda f: f()
>>  File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, 
>> in f
>>  return action(*a, **b)
>>  File 
>> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>>  
>> 
>> , line 31, in tasks
>>  db.task.assigned_to
>>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440
>> , in grid
>>  raise HTTP(200, oExp.export(), **response.headers)
>>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468
>> , in export
>>  self.rows.export_to_csv_file(s, represent=True)
>>  File 
>> "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
>> line 2412, in export_to_csv_file
>>  value = field.represent(value, record)
>>  File 
>> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>>  
>> 
>> , line 17, in 
>>  db.task.title.represent = lambda title, row:A(title, _href=URL(
>> 'view_task', args=row.id))
>>  File 
>> "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py", 
>> line 90, in __getattr__
>>  raise AttributeError
>> AttributeError
>>
>>
>> The error come from the bellow code line from the file default.py
>> db.task.title.represent = lambda title, row:A(title, _href=URL(
>> 'view_task', args=row.id))
>>
>> If I remove the previous row the export function work for all format but 
>> I lose the cliquable link on the task title.
>>
>> I checked with the Notifier application available on GitHub 
>> https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and 
>> I see the same problem.
>>
>> If you can help me it's very appreciate.
>>
>> Kind regards
>> Olivier
>>
>>
>>
>>

-- 
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 

[web2py] Re: GRID export broken for CSV but not for JSON

2016-02-12 Thread Anthony
This can probably be improved, but the problem is that your grid does not 
include all the fields needed by the "represent" function (i.e., it is 
missing the "id" field). You could (a) re-write the represent so it doesn't 
fail when the "id" field is missing, (b) use one of the "hidden column" 
downloads instead, or (c) in the controller, check whether the request is 
for an export (i.e, '_export_type' in request.vars), and include the "id" 
field in that case.

Unfortunately, these solutions mean you either won't have the "represented" 
value in the CSV file (which you may not want anyway, as it is an HTML 
anchor tag in this case), or you will have extra fields that you otherwise 
might want excluded (in this case, the "id" field).

Note, you can also use the "exportclasses" argument to provide your own 
custom export class, and use something like option (c) above, but write the 
export class so it excludes any columns you want to hide.

Anthony

On Friday, February 12, 2016 at 5:01:40 PM UTC-5, olivier hubert wrote:
>
>
> I implemented a clone of Notifier application from Massimo.
> If I try to export data from the grid via the grid bottom button I receive 
> an error if I use export to CSV, HTML & TSV but not with JSON or XML.
>
> *default.py*
> @auth.requires_login()
> def tasks():
> db.task.created_on.readable = True
> db.task.created_by.readable = True
> db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
> query = (db.task.assigned_to==me)|(db.task.created_by==me)
> grid = SQLFORM.grid(query,
> orderby=~db.task.modified_on,
> create=False,
> details=False,
> editable=False,
> deletable=lambda row: (row.created_by==me),
> fields=[
> db.task.status,
> db.task.title,
> db.task.created_on,
> db.task.deadline,
> db.task.created_by,
> db.task.assigned_to
> ])
> return locals()
>
> *Traceback*
>
>  Traceback (most recent call last):
>  File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 
> 227, in restricted
>  exec ccode in environment
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 134, in 
>  File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, 
> in 
>  self._caller = lambda f: f()
>  File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, 
> in f
>  return action(*a, **b)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 31, in tasks
>  db.task.assigned_to
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440, 
> in grid
>  raise HTTP(200, oExp.export(), **response.headers)
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468, 
> in export
>  self.rows.export_to_csv_file(s, represent=True)
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 2412, in export_to_csv_file
>  value = field.represent(value, record)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 17, in 
>  db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 90, in __getattr__
>  raise AttributeError
> AttributeError
>
>
> The error come from the bellow code line from the file default.py
> db.task.title.represent = lambda title, row:A(title, _href=URL('view_task'
> , args=row.id))
>
> If I remove the previous row the export function work for all format but I 
> lose the cliquable link on the task title.
>
> I checked with the Notifier application available on GitHub 
> https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I 
> see the same problem.
>
> If you can help me it's very appreciate.
>
> Kind regards
> Olivier
>
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID export broken for CSV but not for JSON

2016-02-12 Thread Anthony
Which version of web2py?

On Friday, February 12, 2016 at 5:01:40 PM UTC-5, olivier hubert wrote:
>
>
> I implemented a clone of Notifier application from Massimo.
> If I try to export data from the grid via the grid bottom button I receive 
> an error if I use export to CSV, HTML & TSV but not with JSON or XML.
>
> *default.py*
> @auth.requires_login()
> def tasks():
> db.task.created_on.readable = True
> db.task.created_by.readable = True
> db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
> query = (db.task.assigned_to==me)|(db.task.created_by==me)
> grid = SQLFORM.grid(query,
> orderby=~db.task.modified_on,
> create=False,
> details=False,
> editable=False,
> deletable=lambda row: (row.created_by==me),
> fields=[
> db.task.status,
> db.task.title,
> db.task.created_on,
> db.task.deadline,
> db.task.created_by,
> db.task.assigned_to
> ])
> return locals()
>
> *Traceback*
>
>  Traceback (most recent call last):
>  File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 
> 227, in restricted
>  exec ccode in environment
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 134, in 
>  File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, 
> in 
>  self._caller = lambda f: f()
>  File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, 
> in f
>  return action(*a, **b)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 31, in tasks
>  db.task.assigned_to
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440, 
> in grid
>  raise HTTP(200, oExp.export(), **response.headers)
>  File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468, 
> in export
>  self.rows.export_to_csv_file(s, represent=True)
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 2412, in export_to_csv_file
>  value = field.represent(value, record)
>  File 
> "/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
>  
> 
> , line 17, in 
>  db.task.title.represent = lambda title, row:A(title, _href=URL(
> 'view_task', args=row.id))
>  File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py"
> , line 90, in __getattr__
>  raise AttributeError
> AttributeError
>
>
> The error come from the bellow code line from the file default.py
> db.task.title.represent = lambda title, row:A(title, _href=URL('view_task'
> , args=row.id))
>
> If I remove the previous row the export function work for all format but I 
> lose the cliquable link on the task title.
>
> I checked with the Notifier application available on GitHub 
> https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I 
> see the same problem.
>
> If you can help me it's very appreciate.
>
> Kind regards
> Olivier
>
>
>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Grid links in component do not open in new window properly

2016-01-17 Thread fbenhamo102
Could you indicate whether what you did work, please?

I've the same problem, when using appadmin/manage, which internally uses 
the smartgrid:
opening a link in a new tab does not work (nor do the next / previous 
buttons).

The problem I have when trying to implement Anthony's solution is the 
following:
in some cases the grid component returns an image (when a field of the 
table is an image) and this image is retrieved without ajax.

One dirty way to fix this consists in behaving differently depending on the 
query to the smartgrid component, as it seems that these image queries are 
of the form .../table/download/

But is there a better solution?

Le vendredi 14 novembre 2014 17:30:01 UTC+1, Jim Karsten a écrit :
>
> I think I can make this work. Thanks for your help Anthony and Leonel.
>
> Jim
>
> On Thursday, November 13, 2014 9:33:04 AM UTC-5, Anthony wrote:
>>
>> A simpler option might be to check whether the request is being made via 
>> Ajax, and conditionally change the view:
>>
>> def inner(): 
>> response.view = 'default/inner.load' if request.ajax else 
>> 'default/inner.html'
>> grid = SQLFORM.grid(db.item) 
>> return locals() 
>>
>> In that case, the .html view should extend the layout. Alternatively, you 
>> could have a single view with a conditional extends:
>>
>> {{extend 'layout.html' if not request.ajax else None}}
>>
>> Note that the view cannot be compiled in that case.
>>
>> Anthony
>>
>> On Thursday, November 13, 2014 7:37:49 AM UTC-5, Leonel Câmara wrote:
>>>
>>> The problem is that URL, when an extension is not specified, inherits it 
>>> from the current URL which is .load in the case where they are loaded in 
>>> components with extension='load'.
>>>
>>> The thing is, this need to be load, otherwise inner will use the generic 
>>> HTML view extending layout.html and you don't want to have a layout inside 
>>> your layout when you're not opening in a new window.
>>>
>>> So basically inner needs to detect whether it's really a component or 
>>> not, generally that's what the extension is for. The only way I can 
>>> remember to do this would be with stupid javascript hacks. For instance, 
>>> you could make an inner.load view like this:
>>>
>>> {{=grid}}
>>>
>>>
>>> 
>>> $('.web2py_grid a').each(function() {
>>> if (typeof $(this).attr('href') !== 'undefined') {
>>> $(this).attr('href', $(this).attr('href').replace('.load', 
>>> '.html'));
>>> $(this).click(function(e) {
>>> if (e.which == 1) { // If we're left clicking
>>> if(e.ctrlKey) { // ctrl key being pressed also means 
>>> new tab
>>> window.open($(this).attr('href'));
>>> return false;
>>> } else {  // We really want to stay in the component
>>> $(this).attr('href', $(this).attr('href').replace(
>>> '.html', '.load'));
>>> }
>>> }
>>> });
>>> }
>>> });
>>> 
>>>
>>>
>>> What this does is make all links have a .html extension, then if the 
>>> user is left clicking it makes it .load again. Yep, it's ugly, but you 
>>> asked for it.
>>>
>>> [edit] Added a return false that was needed.
>>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Anthony
O

> The issue isn't simply whether there have been changes in the file but 
>> whether there have been changes in the file that are directly linked to 
>> changes in the core framework. web2py.js includes code that depends on 
>> particular HTML classes and data-* attributes generated by web2py HTML 
>> helpers and widgets, so sometimes changes in the core framework are coupled 
>> with changes in web2py.js and the two must therefore be upgraded in tandem. 
>> This is less likely to be the case with other app-specific files. For 
>> example, you can upgrade appadmin.py and appadmin.html, but the old 
>> versions should generally continue to work with new versions of the 
>> framework. It's probably worth upgrading web2py_ajax.html as well.
>>
>
> This just reinforces my point... Perhaps these files (and any others?) 
> should be managed as part of the framework, and not as part of an 
> application.
>

I agree. It's just a matter of figuring out a good mechanism. It's tricky 
with static assets, as often we want to bundle them.
 

> Ok. I see. However, in a production environment I do not exactly want to 
> have the welcome app enabled... Which means that this kind of link should 
> actually NOT work...
>

Good point. I suppose you could use your web server or routes.py to 
redirect all "welcome" requests (except those to /static).

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Krzysztof Socha


On Wednesday, January 6, 2016 at 5:30:25 PM UTC+1, Anthony wrote:
>
>
>> I guess, this is more-less what I need to do, but this is not perfect, as 
>> I have several applications that I maintain and updating all of them 
>> manually is not great. Also - is this the only file that should be updated 
>> in this way? I am not sure... What about web2py_ajax.html? appadmin.html? 
>> Others?
>>
>
> The issue isn't simply whether there have been changes in the file but 
> whether there have been changes in the file that are directly linked to 
> changes in the core framework. web2py.js includes code that depends on 
> particular HTML classes and data-* attributes generated by web2py HTML 
> helpers and widgets, so sometimes changes in the core framework are coupled 
> with changes in web2py.js and the two must therefore be upgraded in tandem. 
> This is less likely to be the case with other app-specific files. For 
> example, you can upgrade appadmin.py and appadmin.html, but the old 
> versions should generally continue to work with new versions of the 
> framework. It's probably worth upgrading web2py_ajax.html as well.
>

This just reinforces my point... Perhaps these files (and any others?) 
should be managed as part of the framework, and not as part of an 
application.
 

>  
>
>>  
>>
>>> This is a good point, though -- perhaps we should come up with a way to 
>>> ensure web2py.js is easily upgraded along with the rest of the framework. 
>>> For now, though, you could always link to the version of web2py.js that 
>>> comes with the "welcome" app, as that will always be upgraded with the 
>>> framework.
>>>
>>>
>> I will try the linking, but not sure how this will work with git 
>> throughout different filesystems and OSes... (I use Linux on some 
>> development systems and BSD on some production servers)... git should 
>> preserve the link, but...
>>
>
> I didn't mean you should create symbolic links to the web2py.js file in 
> the welcome app -- I meant actually serve that file via its usual URL. So, 
> in web2py_ajax.html, instead of using URL('static', 'js/web2py.js'), change 
> it to URL('welcome', 'static', 'js/web2py.js').
>
>
Ok. I see. However, in a production environment I do not exactly want to 
have the welcome app enabled... Which means that this kind of link should 
actually NOT work...

Krzysztof. 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Anthony


>
> I guess, this is more-less what I need to do, but this is not perfect, as 
> I have several applications that I maintain and updating all of them 
> manually is not great. Also - is this the only file that should be updated 
> in this way? I am not sure... What about web2py_ajax.html? appadmin.html? 
> Others?
>

The issue isn't simply whether there have been changes in the file but 
whether there have been changes in the file that are directly linked to 
changes in the core framework. web2py.js includes code that depends on 
particular HTML classes and data-* attributes generated by web2py HTML 
helpers and widgets, so sometimes changes in the core framework are coupled 
with changes in web2py.js and the two must therefore be upgraded in tandem. 
This is less likely to be the case with other app-specific files. For 
example, you can upgrade appadmin.py and appadmin.html, but the old 
versions should generally continue to work with new versions of the 
framework. It's probably worth upgrading web2py_ajax.html as well.
 

>  
>
>> This is a good point, though -- perhaps we should come up with a way to 
>> ensure web2py.js is easily upgraded along with the rest of the framework. 
>> For now, though, you could always link to the version of web2py.js that 
>> comes with the "welcome" app, as that will always be upgraded with the 
>> framework.
>>
>>
> I will try the linking, but not sure how this will work with git 
> throughout different filesystems and OSes... (I use Linux on some 
> development systems and BSD on some production servers)... git should 
> preserve the link, but...
>

I didn't mean you should create symbolic links to the web2py.js file in the 
welcome app -- I meant actually serve that file via its usual URL. So, in 
web2py_ajax.html, instead of using URL('static', 'js/web2py.js'), change it 
to URL('welcome', 'static', 'js/web2py.js').

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Krzysztof Socha


On Wednesday, January 6, 2016 at 1:58:19 PM UTC+1, Anthony wrote:
>
>
> Well, any time you upgrade the framework, you should always upgrade 
> web2py.js (no need to check whether it has changed -- just do it).
>
>
I guess, this is more-less what I need to do, but this is not perfect, as I 
have several applications that I maintain and updating all of them manually 
is not great. Also - is this the only file that should be updated in this 
way? I am not sure... What about web2py_ajax.html? appadmin.html? Others?
 

> This is a good point, though -- perhaps we should come up with a way to 
> ensure web2py.js is easily upgraded along with the rest of the framework. 
> For now, though, you could always link to the version of web2py.js that 
> comes with the "welcome" app, as that will always be upgraded with the 
> framework.
>
>
I will try the linking, but not sure how this will work with git throughout 
different filesystems and OSes... (I use Linux on some development systems 
and BSD on some production servers)... git should preserve the link, but...

Anyway - thanks for your help - it allowed me to pinpoint and fix the 
problem for now.

Krzysztof.
 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID selectable inside component

2016-01-06 Thread Anthony
On Monday, January 4, 2016 at 6:20:42 PM UTC-5, Krzysztof Socha wrote:
>
> Ok. I think I got it... I started developing my application long time ago 
> based on a welcome app. I have updated web2py regularly, but I have not 
> updated original welcome application files that are specific to web2py, 
> such as web2py.js It appears that there have been changes there as well, 
> but they are not handled properly by the update procedure... Once I 
> replaced the web2py.js for my application with a newer version, it works 
> now fine. 
>
> Perhaps these dependencies should be re-thought? Maybe they should be 
> moved out of application tree into somewhere else? Framework-wide js 
> folder, or something... It is not clear how to make sure they are up to 
> date without manually checking after every web2py update... 
>

Well, any time you upgrade the framework, you should always upgrade 
web2py.js (no need to check whether it has changed -- just do it).

This is a good point, though -- perhaps we should come up with a way to 
ensure web2py.js is easily upgraded along with the rest of the framework. 
For now, though, you could always link to the version of web2py.js that 
comes with the "welcome" app, as that will always be upgraded with the 
framework.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: GRID selectable inside component

2016-01-04 Thread Krzysztof Socha
Ok. I think I got it... I started developing my application long time ago 
based on a welcome app. I have updated web2py regularly, but I have not 
updated original welcome application files that are specific to web2py, 
such as web2py.js It appears that there have been changes there as well, 
but they are not handled properly by the update procedure... Once I 
replaced the web2py.js for my application with a newer version, it works 
now fine. 

Perhaps these dependencies should be re-thought? Maybe they should be moved 
out of application tree into somewhere else? Framework-wide js folder, or 
something... It is not clear how to make sure they are up to date without 
manually checking after every web2py update... 

Anyway - thank you for your support!

Cheers,
Krzysztof.

On Friday, January 1, 2016 at 12:27:22 AM UTC+1, Anthony wrote:
>
> Oops, got it. Still can't reproduce.
>
> On Thursday, December 31, 2015 at 5:23:38 PM UTC-5, Krzysztof Socha wrote:
>>
>> As I wrote:
>>
>> 2.13.4-stable+timestamp.2015.12.26.04.59.39
>> (Running on nginx/1.4.6, Python 2.7.6)
>>
>> Strange... I will have to investigate a bit more, than. I will report 
>> back, what I find.
>>
>> Krzysztof.
>>
>> On Thursday, December 31, 2015 at 10:38:10 PM UTC+1, Anthony wrote:
>>>
>>> Sorry, tried your exact code and it works for me. Which version of 
>>> web2py? Maybe attach a minimal app that demonstrates the problem.
>>>
>>> Anthony
>>>
>>> On Thursday, December 31, 2015 at 3:39:37 PM UTC-5, Krzysztof Socha 
>>> wrote:

 Anthony,

 Thank you for (very) quick reaction! And Happy New Year! ;)

 Here is an example:

 I define a grid in the following action:
 def grid_test():
 grid = SQLFORM.grid(db.project, formname='grid_test',selectable=[('Test', 
 lambda ids: 1/0)])
 response.view = 'project/grid.load'
 return dict(grid=grid)

 ...of course the expected behavior is that the 'Test' action will cause 
 an error (division by zero). Indeed, this happens if I simply put such 
 defined grid as part of regular controller action.

 However, when I put it in a component:

 {{=LOAD('project','grid_test.load', ajax=True)}}

 where the grid.load looks like this:

 {{=grid}}

 Pressing the 'Test' button does not cause the error - presumably 
 because the selectable action is not executed at all...

 I hope this is clear enough. In my code, I actually tried to do a 
 redirect, but the result is exactly the same - the selectable action does 
 not appear to execute... I just tested this on:

 2.13.4-stable+timestamp.2015.12.26.04.59.39
 (Running on nginx/1.4.6, Python 2.7.6)

 Krzysztof.

 On Thursday, December 31, 2015 at 8:41:46 PM UTC+1, Anthony wrote:
>
> A basic example works for me. Can you show some code that you know 
> exhibits the problem?
>
> Anthony
>
> On Thursday, December 31, 2015 at 12:53:53 PM UTC-5, Krzysztof Socha 
> wrote:
>>
>> I noticed a similar thing... I need two grids on a page. As 
>> documented, it does not work very well to simply put them in one 
>> controller 
>> function. Hence, I tried with LOADing a component. This generally works, 
>> but I cannot get the selectable actions to work. I have defined custom 
>> selectable actions and they work fine if the gird is not inside a 
>> component. As soon, as I load it as a component, nothing happens. It 
>> seems 
>> that the form is submitted, but the selectable action is not executed. A 
>> bug somewhere? Or is there another way of doing this?
>>
>> Krzysztof.
>>
>> On Wednesday, October 15, 2014 at 7:46:56 PM UTC+2, LaDarrius Stewart 
>> wrote:
>>>
>>> I have a grid inside a component inside a component which has 
>>> selectable set to run a function that assigns the ids to a session 
>>> variable. When inside the component it does not work when i click 
>>> submit I 
>>> can tell that the page is being reloaded but the callback does not run. 
>>> I 
>>> know that the code works because if I go to the .load page directly and 
>>> try 
>>> it works as expected. But from the component page it doesnt execute the 
>>> callback.
>>>
>>>
>>>
>>> selectable = [('Create Invoice', lambda ids: [selectabletest(ids)], 
>>> 'btn btn-info btn-md')]
>>> grid2 = SQLFORM.grid(query, selectable=selectable, 
>>> args=request.args[:1], formname='invgrid', user_signature=False)
>>>
>>> def selectabletest(ids):
>>> session.lambdatest = ids
>>>
>>> This message is for named person(s) only.  It may contain 
>>> confidential and/or legally privileged information.  No confidentiality 
>>> or 
>>> privilege is waived or lost should mis-transmission occur.  If you 
>>> receive 
>>> this message in error, delete it (and all copies) and n

[web2py] Re: GRID selectable inside component

2015-12-31 Thread Anthony
Oops, got it. Still can't reproduce.

On Thursday, December 31, 2015 at 5:23:38 PM UTC-5, Krzysztof Socha wrote:
>
> As I wrote:
>
> 2.13.4-stable+timestamp.2015.12.26.04.59.39
> (Running on nginx/1.4.6, Python 2.7.6)
>
> Strange... I will have to investigate a bit more, than. I will report 
> back, what I find.
>
> Krzysztof.
>
> On Thursday, December 31, 2015 at 10:38:10 PM UTC+1, Anthony wrote:
>>
>> Sorry, tried your exact code and it works for me. Which version of 
>> web2py? Maybe attach a minimal app that demonstrates the problem.
>>
>> Anthony
>>
>> On Thursday, December 31, 2015 at 3:39:37 PM UTC-5, Krzysztof Socha wrote:
>>>
>>> Anthony,
>>>
>>> Thank you for (very) quick reaction! And Happy New Year! ;)
>>>
>>> Here is an example:
>>>
>>> I define a grid in the following action:
>>> def grid_test():
>>> grid = SQLFORM.grid(db.project, formname='grid_test',selectable=[('Test', 
>>> lambda ids: 1/0)])
>>> response.view = 'project/grid.load'
>>> return dict(grid=grid)
>>>
>>> ...of course the expected behavior is that the 'Test' action will cause 
>>> an error (division by zero). Indeed, this happens if I simply put such 
>>> defined grid as part of regular controller action.
>>>
>>> However, when I put it in a component:
>>>
>>> {{=LOAD('project','grid_test.load', ajax=True)}}
>>>
>>> where the grid.load looks like this:
>>>
>>> {{=grid}}
>>>
>>> Pressing the 'Test' button does not cause the error - presumably because 
>>> the selectable action is not executed at all...
>>>
>>> I hope this is clear enough. In my code, I actually tried to do a 
>>> redirect, but the result is exactly the same - the selectable action does 
>>> not appear to execute... I just tested this on:
>>>
>>> 2.13.4-stable+timestamp.2015.12.26.04.59.39
>>> (Running on nginx/1.4.6, Python 2.7.6)
>>>
>>> Krzysztof.
>>>
>>> On Thursday, December 31, 2015 at 8:41:46 PM UTC+1, Anthony wrote:

 A basic example works for me. Can you show some code that you know 
 exhibits the problem?

 Anthony

 On Thursday, December 31, 2015 at 12:53:53 PM UTC-5, Krzysztof Socha 
 wrote:
>
> I noticed a similar thing... I need two grids on a page. As 
> documented, it does not work very well to simply put them in one 
> controller 
> function. Hence, I tried with LOADing a component. This generally works, 
> but I cannot get the selectable actions to work. I have defined custom 
> selectable actions and they work fine if the gird is not inside a 
> component. As soon, as I load it as a component, nothing happens. It 
> seems 
> that the form is submitted, but the selectable action is not executed. A 
> bug somewhere? Or is there another way of doing this?
>
> Krzysztof.
>
> On Wednesday, October 15, 2014 at 7:46:56 PM UTC+2, LaDarrius Stewart 
> wrote:
>>
>> I have a grid inside a component inside a component which has 
>> selectable set to run a function that assigns the ids to a session 
>> variable. When inside the component it does not work when i click submit 
>> I 
>> can tell that the page is being reloaded but the callback does not run. 
>> I 
>> know that the code works because if I go to the .load page directly and 
>> try 
>> it works as expected. But from the component page it doesnt execute the 
>> callback.
>>
>>
>>
>> selectable = [('Create Invoice', lambda ids: [selectabletest(ids)], 
>> 'btn btn-info btn-md')]
>> grid2 = SQLFORM.grid(query, selectable=selectable, 
>> args=request.args[:1], formname='invgrid', user_signature=False)
>>
>> def selectabletest(ids):
>> session.lambdatest = ids
>>
>> This message is for named person(s) only.  It may contain 
>> confidential and/or legally privileged information.  No confidentiality 
>> or 
>> privilege is waived or lost should mis-transmission occur.  If you 
>> receive 
>> this message in error, delete it (and all copies) and notify the sender. 
>>  
>> You must not, directly or indirectly,use, disclose, distribute, print, 
>> or 
>> copy any part of this message if you are not the intended recipient. GAD 
>> GROUP TECHNOLOGY, INC. reserves the right to monitor all e-mail 
>> communications through its networks.
>>
>> Any views expressed in this message are those of the individual 
>> sender, except where the message states otherwise and the sender is 
>> authorized to state them to be the views of any such entity.
>>
>> This e-mail has been virus and content scanned by GAD GROUP 
>> TECHNOLOGY, INC.
>>
>

-- 
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

[web2py] Re: GRID selectable inside component

2015-12-31 Thread Krzysztof Socha
As I wrote:

2.13.4-stable+timestamp.2015.12.26.04.59.39
(Running on nginx/1.4.6, Python 2.7.6)

Strange... I will have to investigate a bit more, than. I will report back, 
what I find.

Krzysztof.

On Thursday, December 31, 2015 at 10:38:10 PM UTC+1, Anthony wrote:
>
> Sorry, tried your exact code and it works for me. Which version of web2py? 
> Maybe attach a minimal app that demonstrates the problem.
>
> Anthony
>
> On Thursday, December 31, 2015 at 3:39:37 PM UTC-5, Krzysztof Socha wrote:
>>
>> Anthony,
>>
>> Thank you for (very) quick reaction! And Happy New Year! ;)
>>
>> Here is an example:
>>
>> I define a grid in the following action:
>> def grid_test():
>> grid = SQLFORM.grid(db.project, formname='grid_test',selectable=[('Test', 
>> lambda ids: 1/0)])
>> response.view = 'project/grid.load'
>> return dict(grid=grid)
>>
>> ...of course the expected behavior is that the 'Test' action will cause 
>> an error (division by zero). Indeed, this happens if I simply put such 
>> defined grid as part of regular controller action.
>>
>> However, when I put it in a component:
>>
>> {{=LOAD('project','grid_test.load', ajax=True)}}
>>
>> where the grid.load looks like this:
>>
>> {{=grid}}
>>
>> Pressing the 'Test' button does not cause the error - presumably because 
>> the selectable action is not executed at all...
>>
>> I hope this is clear enough. In my code, I actually tried to do a 
>> redirect, but the result is exactly the same - the selectable action does 
>> not appear to execute... I just tested this on:
>>
>> 2.13.4-stable+timestamp.2015.12.26.04.59.39
>> (Running on nginx/1.4.6, Python 2.7.6)
>>
>> Krzysztof.
>>
>> On Thursday, December 31, 2015 at 8:41:46 PM UTC+1, Anthony wrote:
>>>
>>> A basic example works for me. Can you show some code that you know 
>>> exhibits the problem?
>>>
>>> Anthony
>>>
>>> On Thursday, December 31, 2015 at 12:53:53 PM UTC-5, Krzysztof Socha 
>>> wrote:

 I noticed a similar thing... I need two grids on a page. As documented, 
 it does not work very well to simply put them in one controller function. 
 Hence, I tried with LOADing a component. This generally works, but I 
 cannot 
 get the selectable actions to work. I have defined custom selectable 
 actions and they work fine if the gird is not inside a component. As soon, 
 as I load it as a component, nothing happens. It seems that the form is 
 submitted, but the selectable action is not executed. A bug somewhere? Or 
 is there another way of doing this?

 Krzysztof.

 On Wednesday, October 15, 2014 at 7:46:56 PM UTC+2, LaDarrius Stewart 
 wrote:
>
> I have a grid inside a component inside a component which has 
> selectable set to run a function that assigns the ids to a session 
> variable. When inside the component it does not work when i click submit 
> I 
> can tell that the page is being reloaded but the callback does not run. I 
> know that the code works because if I go to the .load page directly and 
> try 
> it works as expected. But from the component page it doesnt execute the 
> callback.
>
>
>
> selectable = [('Create Invoice', lambda ids: [selectabletest(ids)], 
> 'btn btn-info btn-md')]
> grid2 = SQLFORM.grid(query, selectable=selectable, 
> args=request.args[:1], formname='invgrid', user_signature=False)
>
> def selectabletest(ids):
> session.lambdatest = ids
>
> This message is for named person(s) only.  It may contain confidential 
> and/or legally privileged information.  No confidentiality or privilege 
> is 
> waived or lost should mis-transmission occur.  If you receive this 
> message 
> in error, delete it (and all copies) and notify the sender.  You must 
> not, 
> directly or indirectly,use, disclose, distribute, print, or copy any part 
> of this message if you are not the intended recipient. GAD GROUP 
> TECHNOLOGY, INC. reserves the right to monitor all e-mail communications 
> through its networks.
>
> Any views expressed in this message are those of the individual 
> sender, except where the message states otherwise and the sender is 
> authorized to state them to be the views of any such entity.
>
> This e-mail has been virus and content scanned by GAD GROUP 
> TECHNOLOGY, INC.
>


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


  1   2   3   4   >