[web2py] Re: How to build a modular menu

2012-07-16 Thread JaapP
Hi Johan, following code works for me to insert some items from the db into a submenu: response.menu = [ ('Home', False, URL('default','index'), []), ] if auth.is_logged_in(): locaties = db(db.locatie.apotheek_id==auth.user.apotheek_id).select() if locaties: locaties_

[web2py] Selective removing sessions

2012-07-21 Thread JaapP
Hi All, i would like to remove sessions for some selected users. I can't find a way to relate a session to a user, is there a way to do this? I already store the sessions in the database, so removing all sessions is easy: @auth.requires_membership('Administrators') def invalidate_sessions():

[web2py] Re: Selective removing sessions

2012-07-22 Thread JaapP
i found the answer, thought to post in case somebody is struggling with the same problem. you can access the session.session_data with cPickle.loads(sessie.session_data)['auth']['user']['id'] --

[web2py] meta generating queries

2012-09-30 Thread JaapP
Hi All, In the past few days i have been struggling with the problem of generating a dynamic query. My goal is to create a reusable model, which gives the possibility to search all fields in a given table for the presence of a string. The result will be a list of id's with the records in whic

[web2py] Re: meta generating queries

2012-10-01 Thread JaapP
Hi Anthony, Thanks (again) for taking the time to answer my question! This gets me going again! I will post the working result here in case somebody else is trying to archieve something like this. Cheers, Jaap --

[web2py] using existing DB connection inside module/class

2012-02-24 Thread JaapP
Hi All, i've been struggling with the following problem for some time and hope anyone can help. When i instantiate a class in a controller (class is in separate file in Modules folder) and i want to use the database from within this instance, i have to pass the DB to the class. Inside this i

Re: [web2py] using existing DB connection inside module/class

2012-02-24 Thread JaapP
Hi Johann, Thanks for your quick reply! I will test the suggestions as made in the previous thread (don't know if this works: https://groups.google.com/forum/?fromgroups#!topic/web2py/0k0Fvw6fmb8 ). bye, Jaap

[web2py] Re: using existing DB connection inside module/class

2012-02-24 Thread JaapP
Hi Wikus, Thanks a lot! Adding a db.commit() after an insert causes the database to be updated. Bye, Jaap

[web2py] Re: using existing DB connection inside module/class

2012-02-25 Thread JaapP
On Feb 24, 6:38 pm, Anthony wrote: > On Friday, February 24, 2012 12:24:03 PM UTC-5, JaapP wrote: > > > Hi Wikus, > > > Thanks a lot! > > Adding a db.commit() after an insert causes the database to be updated. > > The db.commit() shouldn't be needed. Can yo

[web2py] Re: using existing DB connection inside module/class

2012-02-28 Thread JaapP
at your app is using. Is it possible you > made a change to your toolbox module and didn't restart web2py or have > module change tracking turned on? Have you tried removing the db.commit() > and restarting web2py to see if it works without it? Maybe try my sample > code above and see

[web2py] columns option removed from sqlform.grid?

2011-11-11 Thread JaapP
Hi , could anyone give me an hint on this one please: i've been playing with sqlform.grid and noticed that in web2py Version 1.99.3 (2011-11-11 10:27:54) dev i cannot use the columns option any more (TypeError: grid() got an unexpected keyword argument 'colums') This did work in previous version

[web2py] Re: columns option removed from sqlform.grid?

2011-11-11 Thread JaapP
= [db.table.field1, db.table.field2] > > grid = SQLFORM.grid(query, fields=fields) > > I'm still having some issues when using fields in SQLFORM.smartgrid, but > I think it should work fine in SQLFORM.grid. > >      -Jim > > On 11/11/2011 12:22 PM, JaapP wrote: > >

[web2py] Re: SQLForm.grid - How do I use it properly?

2011-11-14 Thread JaapP
One more reason to stick to using fields could be that with fields you can specify the order in which the columns are shown, this didn't work for 'columns' On 14 nov, 18:13, Jim Steil wrote: > Ok, columns are gone again... > > Might just be best to stick with using fields. > >      -Jim > > On 11

[web2py] Re: table, grid, smartgrid, getting better

2011-08-21 Thread JaapP
Hi Massimo, i tried to play a little bit with the 'query=...' part but i can't get it working; #CONTROLLER def locaties(): locaties = SQLFORM.grid(db.locatie,query=db.locatie.mutatie_user_id==auth.user.id) return dict(locaties=locaties) Error: locaties = SQLFORM.grid(db.locatie,query=

[web2py] Re: table, grid, smartgrid, getting better

2011-08-21 Thread JaapP
omatically > > On Aug 21, 7:19 am, JaapP wrote: > > > > > > > > > Hi Massimo, > > > i tried to play a little bit with the 'query=...' part but i can't get > > it working; > > > #CONTROLLER > > def locaties(): > >

[web2py] crud.update change field value in controller

2011-08-28 Thread JaapP
Hi, i am trying to use a crud.update function and want to change the value of a field before passing to the view. i've spent a couple of hours trying and searchin. I found this post http://permalink.gmane.org/gmane.comp.python.web2py/37314 but the suggested use of 'db.table.field.update=' doesn't

[web2py] Re: crud.update change field value in controller

2011-08-28 Thread JaapP
a concrete example? > > On Aug 28, 9:37 am, JaapP wrote: > > > > > > > > > Hi, > > > i am trying to use a crud.update function and want to change the value > > of a field before passing to the view. > > i've spent a couple of hours trying an

[web2py] Re: crud.update change field value in controller

2011-08-28 Thread JaapP
tand from the post i refered to in the beginning Massimo suggests using 'db.table.field.update=...' for changing the existing value? Jaap On Aug 28, 5:16 pm, Bruno Rocha wrote: > On Sun, Aug 28, 2011 at 12:06 PM, JaapP wrote: > >  db.bestelling.bedrag.update = '10' &

[web2py] record versioning and standalone DAL

2013-09-30 Thread JaapP
Hi, i've build a (very small) standalone side project (so, running without Web2Py) that uses the Web2Py DAL, and all goes well. Now i'm trying to enable record versioning. but this seems not to be working (thread._local object has no attribute 'request') Has anybody succeeded in using record

[web2py] can i build a ROWS object from scratch?

2013-10-20 Thread JaapP
Hi All, i've been struggling and googling this problem for may hours, hope someone can give me a hint: i'm trying to create a ROWS object from data i receive from an external webservice. I do not have a corresponding table in the database, and would like to do something like this: *NOT WORKI

[web2py] Re: can i build a ROWS object from scratch?

2013-10-20 Thread JaapP
Hello Anthony, Your code is working for me! If you want to display the rows from a view with {{=rows}} i still get an error, but i use a custom table builder which takes a rows object as input, and this works just fine. In the end, my mistake was not importing a row object, only a rows object..

[web2py] Calling javascript from submenu

2014-02-23 Thread JaapP
Hello, i'm trying to call a javascript function from a submenu item and having some troubles with this. Calling javascript from a level 1 menu works just fine, like this: response.menu = [ (T('File'), False, URL(), [ (T('New'), False, URL('project', 'create'), []) ]), (A('c

[web2py] max value in linked tables

2014-12-28 Thread JaapP
Hi, Any hints about how to tackle the following problem greatly appreciated: given three tables: *employee*: id name ... *contract*: id start_date fte100 ... *employee_contract:* id employee_id contract_id An employee can have one or more contracs; they are linked through the employee_contra

[web2py] Re: max value in linked tables

2014-12-28 Thread JaapP
the last line in my code example should have been: latest_start_date = contr[db.contract.start_date.max()] -- 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) --

[web2py] Re: max value in linked tables

2015-01-05 Thread JaapP
employee.ALL, db.contract.ALL, orderby= > db.employee.id|~db.contract.start_date, distinct=db.employee.id) > > On Sunday, 28 December 2014 15:57:10 UTC-6, JaapP wrote: >> >> Hi, >> >> Any hints about how to tackle the following problem greatly appreciated: >> >>

[web2py] admin password in web2py docker not correct

2017-08-05 Thread JaapP
Hi, Hope to save someone with the same problem some time: i encountered a problem running web2py in a docker; the admin password as set from the start command was not recognised when trying to log into the admin interface. Wrong dockerfile snippet: EXPOSE 8000 CMD ["/usr/bin/python", "/home/w