[web2py] Re: py4web roadmap

2020-01-17 Thread Dave S


On Friday, January 17, 2020 at 1:50:53 PM UTC-8, Jim S wrote:
>
> I'm wondering if there is a roadmap or list of features that you intend to 
> add to py4web.
>
> I'm wondering if we're going to see something similar to SQLFORM.grid.  
> I'm primarily looking for something that would build a filterable 'list' 
> table of records in a table, along with pagination support.
>

IIRC, Massimo has indicated that only FORM will be supported, and that 
something like Datatables should be used to avoid gridlock.

/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/5983aefc-f729-4924-8359-c866d07bcd1c%40googlegroups.com.


[web2py] Re: Adding the loading gif to my application

2020-01-17 Thread Dave S


On Friday, January 17, 2020 at 1:58:12 PM UTC-8, mostwanted wrote:
>
> Hi guys can someone please help me with a clear definition of how I can 
> add a loading gif to my application, one which will be displayed while the 
> user is waiting for a page to open after clicking a link. Most of the 
> discussions on this topic are not clear on how this can be achieved.
>
> Regards
>
> Mostwanted
>

If javascript is enabled (and usually is for web2py pages), the easiest way 
is to load the gif when you load the referencing page (that is, the page 
with the link to be clicked).  Load it with attribute visibility set to 
hidden.  Use the js to detect the link click, and set the attribute to 
visible.

If you're doing a LOAD() within the referencing frame, then the DIV where 
the LOAD() occurs can include 


I haven't done this for a while, so a good refresher for me.

/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/96168dc3-ab96-4454-9bf9-9718d7269732%40googlegroups.com.


[web2py] Adding the loading gif to my application

2020-01-17 Thread mostwanted
Hi guys can someone please help me with a clear definition of how I can add 
a loading gif to my application, one which will be displayed while the user 
is waiting for a page to open after clicking a link. Most of the 
discussions on this topic are not clear on how this can be achieved.

Regards

Mostwanted

-- 
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/3830256a-45c3-495c-8d06-86e1bdbb1a16%40googlegroups.com.


[web2py] py4web roadmap

2020-01-17 Thread Jim S
I'm wondering if there is a roadmap or list of features that you intend to 
add to py4web.

I'm wondering if we're going to see something similar to SQLFORM.grid.  I'm 
primarily looking for something that would build a filterable 'list' table 
of records in a table, along with pagination support.


-Jim

-- 
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/13ab062a-fe7f-4283-a94a-6cbf02097316%40googlegroups.com.


Re: [web2py] py4web - using session object in a template

2020-01-17 Thread Jim Steil
I should re-state my problem.  With web2py I wasn't using session, but
response.  I added a couple of attributes that always got added to the
response object.  Not sure how to mimic that in py4web, or would I even
want to?

-Jim

On Fri, Jan 17, 2020 at 11:16 AM Jim S  wrote:

> Hi
>
> I'm trying to pass a session variable to layout.html but it tells me that
> session is not available:
>
> NameError: name 'session' is not defined
>
> I use this technique in web2py to send a page title to layout.html without
> having to pass it in the returned dict from the controller.
>
> Obviously I'm being lazy using this technique.  Will this work with py4web
> or is it best for me to pass in explicitly in each controller?
>
> -Jim
>
> --
> 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/cgg6M7B_wkI/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/8848279b-e889-4b9b-90a6-664813a47b89%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/CAERBpoBQPW5KvAs00YWV2LNDgFDWchQs5XH4%3DPkgYTp4VskoMQ%40mail.gmail.com.


[web2py] py4web - using session object in a template

2020-01-17 Thread Jim S
Hi

I'm trying to pass a session variable to layout.html but it tells me that 
session is not available:

NameError: name 'session' is not defined

I use this technique in web2py to send a page title to layout.html without 
having to pass it in the returned dict from the controller.

Obviously I'm being lazy using this technique.  Will this work with py4web 
or is it best for me to pass in explicitly in each controller?

-Jim

-- 
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/8848279b-e889-4b9b-90a6-664813a47b89%40googlegroups.com.


[web2py] Help with project (many to many form or table)

2020-01-17 Thread Juan GutiƩrrez
Hello, I'm creating a small project to test the use of web2py.
After going through some of the documentation for web2py I've found myself 
in quite a problem to deal with a many to many insert/update form.

The simplified context for the example is this:
Model: 
There are people (person) and each can only have a home (home). Homes 
(home) have many types of rooms (home_room). Types of rooms (room) are 
asigned to homes (home). A person can spend an amount of minutes in a 
specific room of his home (person_room).
The table to record the amount of minutes a person spends in a room can 
have only one record for a person/room of the home.

Controller:
Index. Show a list of the people in the DB.
Register minutes. Shows a list of the rooms available to the person 
according to the home and process the request to update amount of minutes 
for each room.

View:
Index. Displays a list of records for person. Each person links to the 
register url and using the args sends the person's id.
Register minutes. Should display a table (or form) with the rooms and any 
previous minutes registered to a person so the amounts can be entered or 
updated.

So my problem is creating a table (or form) that presents the left join for 
home_rooms and person so I can enter the minutes for each room and submit 
the information. I've been thinking a solution could be to insert first any 
records from the left join into the person_room table before creating the 
table (or form), but this still leaves me the problem of showing several 
records to update the amount of minutes.

CODE:
Model:

db.define_table('room', Field('name', 'string'))
db.define_table('home', Field('name', 'string'))
db.define_table('home_room', Field('description', 'string'), 
Field('home_id', 'references home'), Field('room_id', 'references room'))
db.define_table('person', Field('name', 'string'), 
Field('home_id','references home'))
db.define_table('person_room', Field('minutes', 'integer'), 
Field('person_id', 'references person'), Field('home_room_id', 'references 
home_room'))


Data:
Home:
home.id home.name
1 city
2 beach
3 winter

Room:
room.id room.name
1 principal
2 secundary
3 living
4 dining
5 gaming

Home_Room:
home_room.id home_room.description home_room.home_id home_room.room_id
1 city principal 1 1
2 city secondary 1 2
3 city living 1 3
4 beach principal 2 1
5 beach living 2 3
6 beach dining 2 4
7 winter principal 3 1
8 winter living 3 3
9 winter gaming 3 5

Person:
person.id person.name person.home_id
1 David 1
2 Sara 2
3 Charles 3
4 Rose 1
5 Fred 2
6 Martin 3


Controllers (default):

def index():
ppl = db().select(db.person.id, db.person.name)
return dict(people=ppl)

def register():
aForm = None
aPerson = db(db.person.id==request.args(0,
 cast=int, 
 otherwise=URL('index')
)
 ).select(db.person.id,
  db.person.name, 
 ).first() or redirect(URL('index'))
fields = ['person_id', 'home_room_id','minutes']
aForm = SQLFORM(db.person_room, fields=fields)
aForm.vars.person_id = aPerson.id
aForm.process(keepvalues=True)
return dict(person=aPerson, form = aForm)


Views:

default/index
{{extend 'layout.html'}}


{{if len(people) == 0:}}
There's no information
{{else:}}
{{for row in people:}}

{{=A('%s'%row.name, _href=URL("register", 
args=row.id))}}

{{pass}}
{{pass}}


default/register
{{extend 'layout.html'}}

{{=person.name}}
{{=form or ''}}



-- 
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/8c397a93-79f8-43e5-8967-759ebb9611b2%40googlegroups.com.