[web2py] Re: switching tabs in built in editor...

2015-11-17 Thread Edward Shave
Ok, so I'm guessing tabs are a web2py feature rather than belonging to the 
codemirror.

So could someone give me a pointer to where in the source a click event is 
assigned to the tabs.

I'd like to switch tabs using ctrl-tab which doesn't appear to do anything 
else at present.

-- 
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: getting confused when running select on joined tables

2015-11-15 Thread Edward Shave
Nearly forgot to come back, sorry for delay...

Switching "&" for "and" fixed my immediate problem and as usual I learnt 
more interesting stuff from your answer.

Many thanks
Ed

-- 
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] getting confused when running select on joined tables

2015-11-14 Thread Edward Shave
I'm sorry if all this is in the book but I can't find it..

I never quite know what to expect when selecting records. Does the book 
make this clear and I missed it. If not what are the criteria that 
determine the output format?

See below where I was initially using a simplified version (row1),  then 
later when I added the filter (row2) the output format changed so I have to 
go rewrite code to suit.

>>> row1=db(db.entry.acc_id==db.acc.id).select().first()
>>> print row1


>>>
>>> row2=db((db.entry.acc_id==db.acc.id) and (db.entry.txn_id==1)).select().
first()

>>> print row2

>>>

Also is there some way to force DAL simply return rows containing just 
values, maybe in the form of list of lists?

Apologies if this turns out to be a silly question but I have been coding 
for a long period without sleep ;o)

-- 
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: How can I improve this clunky code..!

2015-11-09 Thread Edward Shave
for anyone else like me who didn't recognize this part

(f == f.referent for f in db[table_name]._references)

Look up Generator Expressions

-- 
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] How can I improve this clunky code..!

2015-11-09 Thread Edward Shave
I have some code that works but I feel my ignorance is showing...

Using just a table or table-name as input my code compiles a select 
statement which includes all the fields in the table plus any referenced 
tables.


>>> table.name='entry'
>>> table=eval('db.'+table_name)

>>> field_names=table.fields
>>> print field_names
['id', 'txn_id', 'acc_id', 'debit', 'credit']

>>> fields=[table[field] for field in field_names]

>>> refs=['db.'+table_name+'.'+field.name+' == db.'+field.type[10:]+'.id' 
for field in fields if field.type[:9]=='reference']
>>> print refs
['db.entry.txn_id == db.txn.id', 'db.entry.acc_id == db.acc.id']

>>> q=eval('('+') & ('.join(refs)+')')
>>> print q
((entry.txn_id = txn.id) AND (entry.acc_id = acc.id))

>>> s=db(q)
>>> print s


>>> rows=s.select()
>>> print rows[0]

>>>



-- 
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: How can I improve this clunky code..!

2015-11-09 Thread Edward Shave
Anthony, What a brilliant answer..!!!

Thank you so much.

-- 
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] switching tabs in built in editor...

2015-11-03 Thread Edward Shave
Just wondering if there is a keyboard short-cut for switching tabs in built 
in editor?

-- 
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: Is it intended that TABLE(rows) makes a table within a table?

2015-10-25 Thread Edward Shave
Seems I overlooked the obvious..!

Thanks DenesL  :0)

-- 
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] Is it intended that TABLE(rows) makes a table within a table?

2015-10-24 Thread Edward Shave
TABLE(rows) is a nice shorthand way to make a table but I'm getting a table 
within a table starting as below.

...

Is this right?

Or should I not be doing this anyway?

-- 
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: Is it intended that TABLE(rows) makes a table within a table?

2015-10-24 Thread Edward Shave
Thanks Anthony,

The reason I was trying TABLE was because I wanted to include a class in 
the table tag and was thinking this might work...

TABLE(rows, _class="fred")

taking account of your answer I'm now using...

table_as_string = ''+rows.xml(0)[7:]

-- 
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: How to update db record using ajax?

2015-10-22 Thread Edward Shave
Thanks a bunch for your very detailed reply.
After reading your post I have managed to get a version working just the 
way I want.
Thanks again,
Ed

-- 
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] How to update db record using ajax?

2015-10-20 Thread Edward Shave
For some reason I just can't seem to get my head round the ajax 
documentation.
I have what I think is a simple goal.

Using javascript / jQuery, how do I silently update db.person with the 
following data?

{"id":3, "firstName":"John", "lastName":"Doe"}

I appreciate I need to supply a function to take care of this but how to 
call the function from javascript / jQuery?

-- 
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: orderby clause breaking SQLFORM.smartgrid child dialogues

2015-10-17 Thread Edward Shave
Thanks Anthony, your solution worked like a charm, as usual.

-- 
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] orderby clause breaking SQLFORM.smartgrid child dialogues

2015-10-16 Thread Edward Shave
When I set orderby=~db.parent.id the parent grid displays in reverse order 
as wanted.

But now the children list has only a row of buttons on each line. Where has 
the data gone?

I tried setting the orderby clause conditionally like this...

if some condition:
form.orderby=~db.parent.id
 
although this does not cause any error it doesn't reverse the order either, 
so probably not doing anything.

-- 
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: Don't laugh but I like the admin editor ;o)

2015-10-13 Thread Edward Shave
Ok, I don't know why it took so long but just in case anyone else out there 
is as thick as me...

Make sure the editor has the focus before using the find and replace 
feature, otherwise your key presses will be directed to the browser  DOH..!

-- 
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: class being inserted behind my back..!

2015-10-11 Thread Edward Shave
Nope, that's the whole thing running in a new simple application.
I did this so as to eliminate anything else in my code.

The controller is simply...

def index():
return dict()


On Sunday, October 11, 2015 at 9:51:16 AM UTC+1, Leonel Câmara wrote:
>
> Are you getting this result via ajax?
>

-- 
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: class being inserted behind my back..!

2015-10-11 Thread Edward Shave
Thanks for that DenesL,

I already worked out why the font was messy and suspected web2py was adding
the class but it's good that someone has confirmed the details.

I came across this problem when cutting and pasting a demo from bootstrap
website so I assume their code is good.

Adding a class like that seems an odd thing to do, especially as there is
no mention I can find in the documentation.

If we are stuck with this behaviour for some good reason, then maybe the
text-shadow attribute could be amended at the same time as the class is
added?



On Sun, Oct 11, 2015 at 2:23 PM, 'DenesL' via web2py-users <
web2py@googlegroups.com> wrote:

> The btn-default class is added by web2py-bootstrap3.js via
> $('button', target).addClass('btn btn-default');
>
> The "horrible" part comes from this bit in bootstrap-theme.min.css
> text-shadow: 0px 1px 0px white;
>
> Denes
>
>
> On Sunday, October 11, 2015 at 4:58:01 AM UTC-4, Edward Shave wrote:
>>
>> Nope, that's the whole thing running in a new simple application.
>> I did this so as to eliminate anything else in my code.
>>
>> The controller is simply...
>>
>> def index():
>> return dict()
>>
>>
>> On Sunday, October 11, 2015 at 9:51:16 AM UTC+1, Leonel Câmara wrote:
>>>
>>> Are you getting this result via ajax?
>>>
>> --
> 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/KPkEDV9RgUY/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Don't laugh but I like the admin editor ;o)

2015-10-11 Thread Edward Shave
How embarrassing..!  I didn't see them until I read your post.

Funny thing is I spent time looking for them and still didn't see them.
That dark area at the bottom blends in with my windows 10 taskbar
and that together with my eyes being 68 years old are my only excuses.

On Sun, Oct 11, 2015 at 4:36 PM, Anthony  wrote:

>
>> 
>> {{=T("Keyboard shortcuts")}}
>> 
>> 
>> {{=shortcut('Ctrl+S', T('Save via Ajax'))}}
>> {{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
>>  {{=shortcut('Shift+Esc', T('Exit Fullscreen'))}}
>> {{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
>> {{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
>> {{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
>> {{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
>> {{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace
>> All'))}}
>> {{=shortcut('Ctrl-/ ', T('Toggle comment'))}}
>> {{=shortcut('Tab', T('Expand Abbreviation (html files only)'))}}
>> {{=shortcut('Ctrl-Space', T('Autocomplete Python Code'))}}
>> 
>> 
>>
>>
> You shouldn't have to look in the source code for these -- they are shown
> right on the page beneath the editor itself. Are you not seeing them?
>
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/lBGXfPZ6n7A/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Don't laugh but I like the admin editor ;o)

2015-10-11 Thread Edward Shave
Version

2.12.3-stable+timestamp.2015.08.19.00.18.03
(Running on Rocket 1.2.6, Python 2.7.9)

web2py is up to date <http://web2py.com/>


After failing to see the bottom editor menu,

I'm reluctant to say this, but...

I don't see anything when I press Shift-Ctrl-F

On Sun, Oct 11, 2015 at 4:37 PM, Anthony <abasta...@gmail.com> wrote:

> Which version of web2py, platform, and browser? Find and replace works for
> me.
>
>
> On Saturday, October 10, 2015 at 1:41:24 PM UTC-4, Edward Shave wrote:
>>
>> Seems search and replace doesn't work..!  How disappointing.
>>
> --
> 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/lBGXfPZ6n7A/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Don't laugh but I like the admin editor ;o)

2015-10-10 Thread Edward Shave
Seems search and replace doesn't work..!  How disappointing. 

-- 
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: Don't laugh but I like the admin editor ;o)

2015-10-10 Thread Edward Shave
Following Anthiony's links I quickly came across this file...

\applications\admin\views\default\editor_shortcuts.html"

which contais the following...


{{=T("Keyboard shortcuts")}}


{{=shortcut('Ctrl+S', T('Save via Ajax'))}}
{{=shortcut('Ctrl+F11', T('Toggle Fullscreen'))}}
 {{=shortcut('Shift+Esc', T('Exit Fullscreen'))}}
{{=shortcut('Ctrl-F / Cmd-F', T('Start searching'))}}
{{=shortcut('Ctrl-G / Cmd-G', T('Find Next'))}}
{{=shortcut('Shift-Ctrl-G / Shift-Cmd-G', T('Find Previous'))}}
{{=shortcut('Shift-Ctrl-F / Cmd-Option-F', T('Replace'))}}
{{=shortcut('Shift-Ctrl-R / Shift-Cmd-Option-F', T('Replace All'))}}
{{=shortcut('Ctrl-/ ', T('Toggle comment'))}}
{{=shortcut('Tab', T('Expand Abbreviation (html files only)'))}}
{{=shortcut('Ctrl-Space', T('Autocomplete Python Code'))}}



Don't know if they work?  Off to try them now...  :o)

-- 
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] class being inserted behind my back..!

2015-10-10 Thread Edward Shave
I make a button including two classes, btn and btn-primary.
The button shows up OK but the text looks horrible.
Upon inspection I find an extra class (btn-default) has been included..!
What's up guys?


{{extend 'layout.html'}}
This text looks horrible


-- 
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] Don't laugh but I like the admin editor ;o)

2015-10-10 Thread Edward Shave
Only thing is I can't find much by way of instructions for it so if anyone 
can point me in the right direction.

I'm particularly interested in search and replace and any short-cut keys...

Also any nifty undocumented features you may know about.

best regards
Ed

-- 
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: How to disable the calendar widget?

2015-10-10 Thread Edward Shave
Wow! Spoilt for choice  ;o)

Thanks for that Anthony.

I continue to be impressed by the standard of replies here.

-- 
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: How to disable the calendar widget?

2015-10-09 Thread Edward Shave

>
>
>>
Thanks a bunch for that. No way would I have figured that out on my own.

Thanks again,
Ed 

-- 
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] How to disable the calendar widget?

2015-10-07 Thread Edward Shave
I want to use a different datetimepicker 
 widget so I need to disable 
the old one. 

So far I've commented out the following two lines in web2py_ajax.html...

response.files.insert(1,URL('static','css/calendar.css'))
response.files.insert(2,URL('static','js/calendar.js'))

That did the trick but it breaks some code in web2py.js which silently 
fails due to Calendar not defined!
Before I go messing with any more files maybe someone knows a nice clean 
way to disable the calendar widget?

By the way, with just a few lines of code the new one seems to be working 
fine in a SQLForm.

I new what needed to go in the code below but not really where to put it. 
For example should the file links be in the header?
And is the document.ready function needed?
Anyway it works so hopefully it' will do until I get more experienced.

db.define_table('cal_form',
Field('date_in','date'))

def datepicker():
   form=SQLFORM(db.cal_form)
   if form.process().accepted:
   response.flash = 'form accepted'
   elif form.errors:
   response.flash = 'form has errors'
   else:
   response.flash = 'please fill out the form'
   return dict(form=form)

{{extend 'layout.html'}}
{{block head}}

 
{{end}}
Input form
{{=form}}

$(document).ready(function(){
jQuery('#cal_form_date_in').datetimepicker({
timepicker:false,
format:'Y-m-d',
yearStart: '1940'
});
});




-- 
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] How to add new record to drop-down-list?

2015-10-05 Thread Edward Shave
I have a form, SQLFORM.smartgrid (add new record page), containing a 
drop-down-list connected to a table in the database.

 It may be the user does not find a suitable item in the list and in this 
case I would like to allow the option of adding a new item.

Seems like this might be a common requirement so I thought I would seek 
advice/suggestions before trying to reinvent the wheel.

I am a bit conservative so don't really want to get into anything too 
messy. 

Currently I have a link next to the drop-down pointing to another page 
where the user can add a new item and be automatically redirected back.
This works but you lose any other fields data already filled in and have to 
start again. Something less clunky would be nice.

-- 
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] How to get a totals column in my SQLFORM.grid?

2015-09-29 Thread Edward Shave
I can't find a way to use SUM in my grid. It seems the fields list doesn't 
allow any kind of expression?

I see someone has suggested defining a SQL VIEW as a table in the DAL. I 
wonder if  there's a better way?

-- 
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: How to get a totals column in my SQLFORM.grid?

2015-09-29 Thread Edward Shave
Thanks, that works.

-- 
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: Server-side DOM parsing not working for me..!

2015-09-23 Thread Edward Shave
Thanks a bunch Anthony.

Your workaround works but after reading what you had to say regards server 
side dom parsing in the issue you raised, I am now furiously back peddling 
and moving  this stuff clientside. Not a problem as I'm only playing at the 
moment.

Thanks again
Ed

-- 
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] Server-side DOM parsing not working for me..!

2015-09-22 Thread Edward Shave
I have a sqlform.grid where I found each row (tr) contains an id, so in the 
example row below the id="2"

2...

I can't work out why the following returns None

print grid.element('#2')

I also tried grid.element(_id='2') but with the same result

-- 
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: how to add style in header of current page?

2015-09-21 Thread Edward Shave
Many thanks for answers. 

I ended up inserting styles into the block header but in the long run I 
think appending response.files may be the way to go.

I note in retrospect all this stuff is in the book but it took this thread 
to help me make use of it.

one explicit example is worth a thousand words ;o)

-- 
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] how to add style in header of current page?

2015-09-21 Thread Edward Shave
I'm sure this is going to be trivial but I can't seem to find an example...

I want to add some styles into the header of just the specific page I'm 
working on, so not generally wanting to edit layout.htm? 

-- 
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] pre-setting selected item inn dropdown list

2015-09-15 Thread Edward Shave
The following html fragment is generated by SQLFORM.grid (create form)


CashSale


The following code in my controller action successfully sets the select 
value = 1.

form.element(_id='txn_editor_account_id')['_value'] = 1


But the displayed widget remains blank?
What can I do to get the widget to display the new value?

-- 
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: pre-setting selected item in dropdown list

2015-09-15 Thread Edward Shave
Many thanks Leonel for the quick answer which works..!

Thanks again, Ed.

-- 
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] Ok, I give in! How do I install jquery plugin, hoverIntent.js

2012-03-16 Thread Edward Shave
I'm a retired client/server (delphi) programmer and am struggling to learn 
the new stuff as I go..

I downloaded the file *jquery.hoverIntent.js* and placed it in the 
static/js directory.

I added the following line to web2py_ajax.html...

*response.files.insert(4,URL('static','js/jquery.hoverIntent.js'))*

Doesn't appear to be working?


[web2py] Re: Ok, I give in! How do I install jquery plugin, hoverIntent.js

2012-03-16 Thread Edward Shave
Oh, right, I didn't realize that. Anyway, I've removed the line where I 
attempted to install it.

My code is in layout.html and here I've shown it in context as the last 
line. It works with hover but not hoverIntent?

* {{include 'web2py_ajax.html'}}*
*
*
*...script type=text/javascript*
**
*
jQuery(function(){jQuery('ul.sf-menu').supersubs({minWidth:12,maxWidth:30,extraWidth:3}).superfish();});
*
*
*
*jQuery(function(){ 
jQuery('.sm_parent').click(function(){jQuery(this).next('ul').slideToggle()});});
 
  *
*
*
*jQuery(function(){ 
jQuery('.sm_parent').hoverIntent(function(){jQuery(this).next('ul').slideDown()});});
 
 *
**
*/script...*


On Friday, 16 March 2012 14:22:50 UTC, Anthony wrote:

 Note, if you have included the superfish.js file (which the welcome 
 layout.html includes by default if there is a response.menu), hoverIntent 
 is already included in there (along with Supersubs), so no need to include 
 it separately.

 Anyway, what isn't working? Is the file not being loaded by the browser, 
 or is it being loaded, but you're just not observing the behavior you 
 expect (in which case, show the Javascript code you are using to set up 
 hoverIntent).

 Anthony

 On Friday, March 16, 2012 9:45:51 AM UTC-4, Edward Shave wrote:

 I'm a retired client/server (delphi) programmer and am struggling to 
 learn the new stuff as I go..

 I downloaded the file *jquery.hoverIntent.js* and placed it in the 
 static/js directory.

 I added the following line to web2py_ajax.html...

 *response.files.insert(4,URL('static','js/jquery.hoverIntent.js'))*

 Doesn't appear to be working?


 On Friday, March 16, 2012 9:45:51 AM UTC-4, Edward Shave wrote:

 I'm a retired client/server (delphi) programmer and am struggling to 
 learn the new stuff as I go..

 I downloaded the file *jquery.hoverIntent.js* and placed it in the 
 static/js directory.

 I added the following line to web2py_ajax.html...

 *response.files.insert(4,URL('static','js/jquery.hoverIntent.js'))*

 Doesn't appear to be working?



[web2py] Re: Ok, I give in! How do I install jquery plugin, hoverIntent.js

2012-03-16 Thread Edward Shave
Ok, many thanks for your input. I'll let you know if I find an answer.

Thanks again,
Ed.


[web2py] Where is base.css referenced?

2012-03-15 Thread Edward Shave
I feel I must be missing something obvious, but despite the references to 
base.css in the book and the comments in the file itself, I can't find 
where it is referenced by the welcome app?

[web2py] Re: Where is base.css referenced?

2012-03-15 Thread Edward Shave
Oh, I went straight to base.css after reading the following in the the 
review section of the book...

*Configuring the layout*

*You can configure the default layout by editing views/layout.html but 
you can also configure it without editing the HTML. In fact, the 
static/base.css stylesheet is well documented and described in Chapter 5. 
You can change color, columns, size, borders and background without editing 
the HTML. If you want to edit the menu, the title or the subtitle, you can 
do so in any model file. The scaffolding app, sets default values of these 
parameters in the file models/menu.py:*
Thanks for putting me right,
Ed

On Thursday, 15 March 2012 15:50:49 UTC, Anthony wrote:

 There is no longer a base.css -- it is now web2py.css.

 Anthony

 On Thursday, March 15, 2012 11:44:07 AM UTC-4, Edward Shave wrote:

 I feel I must be missing something obvious, but despite the references to 
 base.css in the book and the comments in the file itself, I can't find 
 where it is referenced by the welcome app?


On Thursday, 15 March 2012 15:50:49 UTC, Anthony wrote:

 There is no longer a base.css -- it is now web2py.css.

 Anthony

 On Thursday, March 15, 2012 11:44:07 AM UTC-4, Edward Shave wrote:

 I feel I must be missing something obvious, but despite the references to 
 base.css in the book and the comments in the file itself, I can't find 
 where it is referenced by the welcome app?



[web2py] Re: db.mytable.myfield.represent= ???

2012-03-09 Thread Edward Shave
Hi Anthony,

Many thanks for the detailed reply. It seems I had my head on backwards 
when I penned the question. I should explain I am new to both web2py and 
python...

After reading your reply the scales have lifted from my eyes and all is 
clear.

My only defence for wasting your time is the remaining ambiguity regards 
the input parameters in the book. I do believe the book could benefit by 
the inclusion of your words as quoted below...

*represent should be a callable that takes two arguments. When the field 
in question is being represented (e.g., in a SQLFORM or SQLTABLE), the 
field value will be passed to the represent function as the first argument, 
and the entire row object that contains the field value will be passed as 
the second argument. The function itself can then do whatever you want with 
those two arguments to generate a representation of the field.*

Thanks again,
Ed.


[web2py] Re: How to display reference field in sqltable?

2012-03-09 Thread Edward Shave
Many, many thanks for that. I ran your fix and now all is present and 
correct.

Thanks again,
Ed

On Friday, 9 March 2012 07:01:25 UTC, nick name wrote:

 On Thursday, March 8, 2012 8:52:34 PM UTC-5, Edward Shave wrote:

 Many thanks for reply, unfortunately it didn't work in this instance... I 
 wonder if it is because the table is referencing itself?


 By coincidence, I noticed the same problem earlier myself and opened 
 ticket #700 http://code.google.com/p/web2py/issues/detail?id=700 .

 It's not just self-referencing tables; it's referencing any table that has 
 not yet been defined. I also posted a more general solution in the ticket. 



[web2py] Re: How to display reference field in sqltable?

2012-03-08 Thread Edward Shave
Many thanks for reply, unfortunately it didn't work in this instance... I 
wonder if it is because the table is referencing itself?

Anyway I have found the following works but I wonder about the efficiency? 

*db.account.transfer_acc.represent= lambda value:db.account[value].name*

On Thursday, 8 March 2012 11:27:14 UTC, Alan Etkin wrote:

 This should tell web2py to display the name instead of the id in 
 references 

 db.define_table('account', ..., format='%(name)s') 

 You can find more info in the book's chapter 6.5, Record 
 representation 

 On 7 mar, 20:52, Edward Shave ed.sh...@eshavefindings.co.uk wrote: 
  *I have the following table definition...* 
  * 
  * 
  *db.define_table('account', 
  * 
  *Field('name'),* 
  *Field('transfer_acc','reference account'), 
  * 
  *)* 
  * 
  db.account.name.requires = IS_NOT_EMPTY() 
  * 
  * 
  db.account.transfer_acc.requires = IS_IN_DB(db,db.account.id,'%(name)s') 

  
  ...Note the table contains a self referencing field. 
  
  * 
  *The reference field displays the referenced id in sqltable... What is 
 best 
  way to replace id with name of account? *



[web2py] db.mytable.myfield.represent= ???

2012-03-08 Thread Edward Shave
below is an extract from the book which describes the field represent 
feature


   - *represent can be None or can point to a function that takes a field 
   value and returns an alternate representation for the field value. Examples:
   *

*1.
2.
3.
4.*

*db.mytable.name.represent = lambda name,row: name.capitalize()
db.mytable.other_id.represent = lambda id,row: row.myfield
db.mytable.some_uploadfield.represent = lambda value,row: \
A('get it', _href=URL('download', args=value))*


The more I look at the examples and read the explanation the less sense I 
can make of it? There is no doubt it works (at least sometimes) because I 
have pasted modifed versions into my code and seen it works. Problem is I 
don't understand how to use it in general.

The text refers to a function that takes a field value but the parameters 
in the example imply a whole record can be passed as a parameter. In fact I 
found almost any random text can be passed as a parameter without causing 
an error?  My understanding is that represent expects to receive a string 
value, but simply putting a string after the = does not work?

Can anyone explain in more detail how this feature works, especialy in 
terms of input parameters?




[web2py] How to display reference field in sqltable?

2012-03-07 Thread Edward Shave
*I have the following table definition...*
*
*
*db.define_table('account',
*
*Field('name'),*
*Field('transfer_acc','reference account'),
*
*)*
*
db.account.name.requires = IS_NOT_EMPTY()
*
*
db.account.transfer_acc.requires = IS_IN_DB(db,db.account.id,'%(name)s')

...Note the table contains a self referencing field.

*
*The reference field displays the referenced id in sqltable... What is best 
way to replace id with name of account? *


[web2py] Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Currently I am using this

db.ledger.amount.represent=lambda value: DIV(value, _style=width 100%; 
text-align:right;)




[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Thanks for pointing out the mistake in the width attribute, seems it's not 
needed in SQLTABLE, but was in the static mock-up.

Being new to this I couldn't see a way to get at the td tag with css. 
Although I see Anthony has shown a way in another answer


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Many thanks for supplying the right answer, unfortunately I realise now I 
posed the wrong question.

Your right answer was new to me and I can certainly make good use of it.

The question should have been...  *Is there a better way to right justify 
numeric fields (more specifically, decimal) in a SQLTABLE?*
*
*
I don't want to have to change the css if I change to number or order of 
columns...

Thanks again...



[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
 change *the*number or order of columns... 


[web2py] Re: Is there a better way to right justify an SQLTABLE column?

2012-02-20 Thread Edward Shave
Many thanks again Anthony, I will look into both your suggestions, I may be 
gone sometime. LOL.

[web2py] Re: menu problem when importing layout

2012-02-16 Thread Edward Shave
Has anyone an answer for this yet?

[web2py] Re: menu problem when importing layout

2012-02-16 Thread Edward Shave
Hi Anthony, In case thodoris isn't around

I'm assuming this problem is the same as I ran into when using the layout 
plugins... Just seems like drop down (sub) menus aren't supported?

To see this just upload one into the welcome app.

Regards, Ed


[web2py] Re: How to change menu colors?

2012-02-12 Thread Edward Shave
Thanks for that...  Also had to make changes to topbar in order to get 
color across the whole screen.

[web2py] accessing admin via ssh fails with:- admin disabled because unable to access password file

2012-02-12 Thread Edward Shave
Hi, despite being a total novice with little or no experience beyond 
windows I have managed to install web2py on a webfaction shared server. By 
substituting my webfaction application listening port into the 
 instructions I found here... 
http://docs.webfaction.com/user-guide/databases.html#starting-an-ssh-tunnel-with-putty
   I 
can connect to my web2py application over SSH. Problem is when I try to 
access admin I get  admin disabled because unable to access password 
file. 

I found a lot of references to this error when searching the group but no 
real answer. There was some talk of admin using port 80 maybe when looking 
for the password? Another suggestion was that I should have two instances 
of web2py running on the server but I think that's only necessary if admin 
has been disabled, which in my case I don't think it has. Either way I 
don't know how to go about fixing it.

Here you can find the web2py install script I used...  
http://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi

One last question... Is there any need to access admin on the server? I'm 
wondering if I can just make changes localy then upload the changes via ftp?


Re: [web2py] accessing admin via ssh fails with:- admin disabled because unable to access password file

2012-02-12 Thread Edward Shave
What you say is very interesting as it caused me to go back to the 
installation script which contains the following line...

python -c from gluon.main import save_password; 
save_password('${web2py_password}',443)

I have no idea where the 443 comes from, but when I renamed the file using 
my port number... viola it worked..!

Many, many thanks for your help
Kind regards
Ed


[web2py] How to change menu colors?

2012-02-11 Thread Edward Shave
Ok, I give in 

Is there any easy way to change menu colors in the welcome app? If not then 
what is the recommended hard way? (smile)


[web2py] Re: Anyone deployed web2py on 1and1 shared hosting?

2012-02-08 Thread Edward Shave
Just an update I opened a webfaction account, pointed one of my 1and1 
domains to it, and installed web2py by running a single script I found on 
the webfaction forum... Install web2py with nginx and 
uwsgihttp://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgi


[web2py] Anyone deployed web2py on 1and1 shared hosting?

2012-02-05 Thread Edward Shave
If so, would appreciate any pointers. I'm a beginner with little or no 
experience and don't know where to start... :o)


[web2py] Re: Anyone deployed web2py on 1and1 shared hosting?

2012-02-05 Thread Edward Shave
Yes, thanks for that. I managed to run info.py and there was no mention of 
mod_python. I couldn't even work out how to copy files to htdocs. Anyway, 
have decided to move to webfaction where it seems I will have much more 
control and access. I was just hoping someone may have already done it.  ;o)


[web2py] How to get a dropdown in self referencing table, create form?

2012-02-02 Thread Edward Shave
I have defined the following self referencing table.

db.define_table(
'account',
Field('name'),
Field('asset','boolean', default=False),
*Field('transfer','reference account'),*
format = '%(name)s',
singular = 'Account',
plural = 'Accounts',
)

How to get a drop down widget in create form for self referencing field?

I have seen talk of [represent], but need an example,

Any help will be much appreciated.

Ed



[web2py] Re: How to get a dropdown in self referencing table, create form?

2012-02-02 Thread Edward Shave
Found this works following definition

db.account.transfer.requires = IS_IN_DB(db,db.account.id,'%(name)s')