[web2py] Re: Question regarding building dynamic queries

2017-10-04 Thread Leonel Câmara
This is sort of a python question. Lets see exactly what this means query &= db.orders.status == status. This syntax is a python (not web2py or the DAL) shorthand for: query = query & (db.orders.status == status) So really what you want is: query = db.orders.id_buyer == auth.user_id query1

[web2py] Question regarding building dynamic queries

2017-10-04 Thread Sarbjit
I have some basic question regarding forming dynamic queries As an example, lets say my base query is query = db.orders.id_buyer == auth.user_id Now I want to form two different queries like query &= db.orders.status == status. ===> Should form query1 and want to store it for later use AND

[web2py] Re: represent in sqlform.grid and javascript

2017-10-04 Thread 黄祥
for 1st problem, tried to print the value of the field just curious what SQLFORM.grid() does with this kind of data with represent, so that it can appears smoothly, while using another it's throw an error, any idea or hints? thanks and best regards, stifan -- Resources: - http://web2py.com

[web2py] parse_as_rest represent

2017-10-04 Thread Carlos Cesar Caballero Díaz
Hi, can I use the represent feature (or some alternative) for specify how some specific data should be exposed in my parse_as_rest() rest api? Let's say by example, that I have some field wich use uppercase, but for some reason I need it at lowercase in the rest api. Greetings. --

[web2py] Re: update_or_insert -- I end up with duplicates

2017-10-04 Thread Anthony
update_or_insert first selects the record (if it exists) and then does the create/update. I suppose when two requests come in very close to each other, the second request is checking for the record before the first request has had a chance to commit the insert. I'm not sure I would call that a

[web2py] Issues with Scheduler (suddenly multiple tickers appear)

2017-10-04 Thread Boris Aramis Aguilar Rodríguez
Hi, I've been recently using lots of tasks scheduled on a server so I had to use several workers to deal with the queue, currently I'm using 45 workers. Somewhere between 12 hours after starting the 45 workers, suddenly tasks start accumulating in the queue and workers are alive (they report a

[web2py] update_or_insert -- I end up with duplicates

2017-10-04 Thread Brad Miller
Hi All, I have the following update or insert statement in a controller. db.grades.update_or_insert( ((db.grades.auth_user == student.id) & (db.grades.assignment == assignment.id)), auth_user = student.id, assignment =

Re: [web2py] Re: Upcoming birthdays

2017-10-04 Thread Jim S
Thanks again everyone. Here is what I came up with for a solution. I really appreciate all the helpful input. # find the upcoming birthdays start_date = request.now.date() end_date = start_date + relativedelta(months=+1) this_month = db((db.employee.dob.month() == start_date.month) &

Re: [web2py] Re: Upcoming birthdays

2017-10-04 Thread Jim Steil
Thanks, I'll work through this and post my code once I get to the office this morning. -Jim On Wed, Oct 4, 2017 at 4:25 AM, Dave S wrote: > > > On Tuesday, October 3, 2017 at 5:08:27 PM UTC-7, Dave S wrote: >> >> >> >> On Tuesday, October 3, 2017 at 4:48:52 PM UTC-7, Jim

[web2py] Re: represent in sqlform.grid and javascript

2017-10-04 Thread 黄祥
*modules/test_grid.py* def list(table): query = (table.is_active == True) items = current.db(query).select(orderby = ~table.created_on).render() actions = [ {'is_item_action': lambda item: True, 'url': lambda item: URL('view', args = [item.id] ), 'icon': 'zoom-in', 'title':

[web2py] Re: Rocket logs and server crash (upload focus)

2017-10-04 Thread Dave S
On Thursday, September 28, 2017 at 4:33:27 PM UTC-7, Dave S wrote: > > > [...] > I did an experiment with going back to http (no-ess) so that I could read > the frames in tcpdump, and I see that the client is getting the > Content-Length header in (and it appears to this Mk I eyeball to be >

Re: [web2py] Re: Google AMP - benefits with web2py?

2017-10-04 Thread Dave S
On Tuesday, October 3, 2017 at 4:49:22 AM UTC-7, Ramos wrote: > > People should use a tool to minimize js and css files. > Grunt or Gulp for ex... > > Doesn't web2py provide for minimization? It seems to me that I saw that looking at changes in 2.15.4. /dps > 2017-09-29 23:34 GMT+01:00

[web2py] Re: represent in sqlform.grid and javascript

2017-10-04 Thread Dave S
I think you should show how you're setting up the datatables.net context. It looks like there is something about how pydal is called from that context, perhaps something that SQLFORM.grid initializes that is being missed in the JS setup. /dps On Wednesday, October 4, 2017 at 1:42:19 AM

Re: [web2py] Re: Upcoming birthdays

2017-10-04 Thread Dave S
On Tuesday, October 3, 2017 at 5:08:27 PM UTC-7, Dave S wrote: > > > > On Tuesday, October 3, 2017 at 4:48:52 PM UTC-7, Jim S wrote: >> >> I don't think that will do it. The date stored in the database would be >> 10/15/1980, or 10/21/1993. >> >> Those should both show a birthday in the month

[web2py] represent in sqlform.grid and javascript

2017-10-04 Thread 黄祥
*modules/test_field_constructor.py* represent_reference_0 = lambda value, field: \ A('%s, %s, %s' % (field.address.street, field.address.city, field.address.country), _href="http://maps.google.com/maps?f=q=en=%s,+%s,+%s; % (field.address.street, field.address.city,

[web2py] Filter python list based on JavaScript variable in views

2017-10-04 Thread Mujeeb Farees
Hi, The controller returns rows from building table via which the dropdown is populated. When a user selects a building from the dropdown, the address of the building should be displayed in the paragraph tag. Here is what I have done so far, *Controller* def index(): return