[web2py] Re: orderby first, then limitby
In DAL, I don´t know If this can be done. On 9 jun, 10:40, luifran wrote: > In sql, you can apply first order by and then limitby for example in > Oracle: > > select * from > (select * from table > order by field) > where rownum<11//row 1 to 10 after order > > On 9 jun, 09:52, pbreit wrote: > > > > > > > > > I have a query that includes both orderby and limitby. What seems to happen > > is that the db returns some set of records as dictated by the limit and then > > orders the records in that set. So I pretty much get the same set every time > > even though I know the field being ordered has changed for various records. > > Is this how SQL works? Is there any way to order the whole set first and > > then return the sub-set?
[web2py] Re: orderby first, then limitby
In sql, you can apply first order by and then limitby for example in Oracle: select * from (select * from table order by field) where rownum<11//row 1 to 10 after order On 9 jun, 09:52, pbreit wrote: > I have a query that includes both orderby and limitby. What seems to happen > is that the db returns some set of records as dictated by the limit and then > orders the records in that set. So I pretty much get the same set every time > even though I know the field being ordered has changed for various records. > Is this how SQL works? Is there any way to order the whole set first and > then return the sub-set?
[web2py] Re: tables in pdf
How? can you explain to me? On 8 jun, 13:58, Ovidio Marinho wrote: > use css to render its tables or render tags html. > > Ovidio Marinho Falcao Neto > ovidio...@gmail.com > 88269088 > Paraiba-Brasil > > 2011/6/8 luifran > > > > > > > > > Hi, > > I need build tables in pdf, but the length of content cell change and > > I need > > that autoresize this cell for the content fit to the cell. > > I tried pyfpdf with cell and appreport plugin but when the cell > > content is too long > > this content is out of the cell or the letter size is smaller. > > there is a way for build correct tables in pdf without that problems? > > > Thanks.
[web2py] tables in pdf
Hi, I need build tables in pdf, but the length of content cell change and I need that autoresize this cell for the content fit to the cell. I tried pyfpdf with cell and appreport plugin but when the cell content is too long this content is out of the cell or the letter size is smaller. there is a way for build correct tables in pdf without that problems? Thanks.
[web2py] Re: Deploying with default web2py server?
depends on the requirements of your system, but in principle the web2py development server is sufficient On 30 mayo, 21:58, ra3don wrote: > I apologize if this has already been answered somewhere. > > Are there any disadvantages to deploying using the default server that > comes with web2py?
[web2py] Re: class example on book
I put the following code and it works fine: === controller === class MyClass(object): z = 2 def __init__(self, a, b): self.x = a self.y = b def add(self): return self.x + self.y + self.z def index(): myinstance = MyClass(3, 4) add = myinstance.add() return dict(add = add) === view === {{=add}} On 21 mayo, 07:59, Anthony wrote: > I think you want: > > self.x,self.y = a,b > > When you get a Python error, try the code in a Python shell first so you can > easily see whether the problem is web2py-specific or just a Python issue. > > Anthony > > > > > > > > On Saturday, May 21, 2011 6:00:02 AM UTC-4, 黄祥 wrote: > > hi, > > > is there any class example on book or appliances, so that i can learn > > from it? > > i've already tried the simple things what written on book, but got an > > error. do you have any hints or solutions? > > thank you so much before > > > e.g. > > === controller === > > > class MyClass(object): > > z = 2 > > def __init__(self, a, b): > > self.x = a, self.y = b > > def add(self): > > return self.x + self.y + self.z > > > def index(): > > myinstance = MyClass(3, 4) > > add = myinstance.add() > > return dict(add = add) > > > === view === > > {{add}}
[web2py] Re: class example on book
In the view must be for example {{=add}} On 21 mayo, 12:00, 黄祥 wrote: > hi, > > is there any class example on book or appliances, so that i can learn > from it? > i've already tried the simple things what written on book, but got an > error. do you have any hints or solutions? > thank you so much before > > e.g. > === controller === > > class MyClass(object): > z = 2 > def __init__(self, a, b): > self.x = a, self.y = b > def add(self): > return self.x + self.y + self.z > > def index(): > myinstance = MyClass(3, 4) > add = myinstance.add() > return dict(add = add) > > === view === > {{add}}
[web2py] Visual Report Generator
I can use visual report generator with web2py? which?
[web2py] Re: Crontab with WSGI
No , only in web2py, not in cherokee. Where I write this code? 0-59/1 * * * * cd /var/web2py && python web2py.py -C -D 1 > /dev/null 2>&1 On 13 mayo, 15:02, pbreit wrote: > I doubt it's a Cherokee problem. Do you have a crontab set up on your > server? > > For example, this is what I have in my unix crontab (not web2py crontab). > Cron is still a little confusing to me. > > MAILTO=c...@myserver.com > > 0-59/1 * * * * cd /var/web2py && python web2py.py -C -D 1 > /dev/null 2>&1
[web2py] Re: Crontab with WSGI
http://127.0.0.1:8000/myapp/default/limpiar_eventos work fine in cherokee web server, and crontab work fine in web2py´s server but not in cherokee web server. On 13 mayo, 10:08, pbreit wrote: > Do you have those spaces in there? The cron line should be: > > 55 07 * * * root *default/limpiar_eventos > > Are you able to run the function in your browser? > > http://127.0.0.1:8000/myapp/default/limpiar_eventos
[web2py] Crontab with WSGI
I tried the following with the test server and it works In crontab: 55 07 * * * root * default / limpiar_eventos In the default controller def limpiar_eventos (): totalFilas = db (db.auth_event.id> 0). count () totalFilas if> 30: for row in db (db.auth_event.id> 0). select (limitby = (0, 2)): db (db.auth_event.id == fila.id.) delete () db.commit () But this, in Cherokee web server with WSGI does not work. why?
[web2py] query
I have the following query: usuarios_in=db(db.auth_membership.user_id==db.auth_user.id).select(db.auth_user.username) #This show users in membership I have show users out of membership with the following query: usuarios_out=db(db.auth_membership.user_id! =db.auth_user.id).select(db.auth_user.username) This is correct? Not work fine to me.
[web2py] Problem with Select OPtion
This work fine: def combo(): usuarios=db(db.auth_user.registration_key=='pending').select() form = (SELECT([OPTION(usuarios[0].username, _value=usuarios[0].id) for texto in usuarios],_name='combo')) return dict(form=form) This not work fine, does not appear the form: def combo(): usuarios=db(db.auth_user.registration_key=='pending').select() form = (SELECT([OPTION(usuarios[0].username, _value=usuarios[0].id) for texto in usuarios],_name='combo'),INPUT(_type='submit',_value='Aceptar')) if form.accepts: return dict(form=form) Why? I need the button on the form to run an action on the database, as I could do?
[web2py] Re: Webgrid options
I did, deleting 'add_links' to grid.enabled_rows On 29 abr, 11:11, luifran wrote: > I'm usingWebGrid, but sometimes I just want to use it to > show records, not to edit, delete,view,add ... > With this line: grid.action_links = [ ],I remove > edit, delete, and view but not add records. > Can I remove the option to add records?
[web2py] Re: Backup Database
If I use import_from_csv_file and this fail, rollback is automatic? On 3 mayo, 14:59, luifran wrote: > What mechanisms? > > On 2 mayo, 23:20, howesc wrote: > > > > > > > > > i'm a little old-skool and just use thedatabase'sbackupmechanisms since > > they are slightly different from db to db, but in general faster to run than > > CSV dump and import. > > > cfh
[web2py] Re: Backup Database
What mechanisms? On 2 mayo, 23:20, howesc wrote: > i'm a little old-skool and just use the database's backup mechanisms since > they are slightly different from db to db, but in general faster to run than > CSV dump and import. > > cfh
[web2py] Re: Backup Database
Is true, I have a other problem, I have a sqlite file.csv, and I want to import this file to mysql database and appears the following error: Cannot add or update a child row: a foreign key constraint fails (`sinrisk`.`auth_event`, CONSTRAINT `auth_event_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) ON DELETE CASCADE)') With sqlite works fine but not with mysql. On 2 mayo, 18:47, pbreit wrote: > According to the book: > > "When importing, the new records will be appended to the database if it is > not empty. In general the new imported records will not have the same record > id as the original (saved) records but web2py will restore references so > they are not broken, even if the id values may change." > > http://web2py.com/book/default/chapter/06?search=export_to_csv_file > > Have you tried it?
[web2py] Re: Backup Database
The problem is this, I have for example the following tables and records: db.define_table ('a ', Field ('name', 'string')) db.define_table ('b', Field ('name', 'string '), Field ('a ', db.a)) Table record's a: id-> 1, name-> 'name1' no id-> 2 because such has been removed. id-> 3, name-> 'name3' Table record's b: id-> 1, name-> 'name1', a-> 3 When exported in csv and then import it ignores the record's id of the Table 'a', and are assigned according to the sequence again, first I make a drop_table to start the sequence, so that record with id-> 3 now the id-> 2,because IDs that are assigned consecutively, at this point the record in table 'b' which was linked to that record, their relationship no longer exists because there are none with id = 3. On 2 mayo, 17:16, pbreit wrote: > db.export and db.import should work fine and preserve any relationships. I'm > not sure I understand what problem you are seeing.
[web2py] Backup Database
How I can make backups of my database to restore in the future? I tried it with db.export_to_csv_file and db.import_from_csv_file, but does not work because as you read and introducing bellonging ignores the id fields and enter according to the sequence, then the relationships I have and that are not consecutive not work fine. How I can fix this problem?
[web2py] Webgrid options
I'm using WebGrid, but sometimes I just want to use it to show records, not to edit, delete,view,add ... With this line: grid.action_links = [ ],I remove edit, delete, and view but not add records. Can I remove the option to add records?
[web2py] Re: submit forms to press the enter key
yes, my crud form has only two drop down list. On 15 abr, 00:29, Stifan Kristi wrote: > is your focus is on the text area, check box or drop down list? > > best regards, > > steve van christie
[web2py] Re: submit forms to press the enter key
I have not seen the behavior work on other web sites On Apr 14, 11:42 am, pbreit wrote: > Oh, yeah, if there is a drop-down, then I think the focus on it takes > precedence. I'm not sure if there's a work-around. Have you seen the > behavior work on other web sites?
[web2py] Re: submit forms to press the enter key
I've tried, but does not work, it seems that when a table is 2 or more fields referenced by other tables, the focus stays on the dropdown list and you have to press Tab to place focus on the button, with no simple crud occurs, perhaps only occurs because the table only has fields referenced by other tables. The truth is that I have no idea what happens. On Apr 14, 3:39 am, luifran wrote: > I will try to run on Windows XP and other browsers and I tell you. > > On 14 abr, 09:47, Stifan Kristi wrote: > > > > > > > > > work fine for me on ubuntu 10.10 with chrome and firefox. > > > On Thu, Apr 14, 2011 at 2:42 PM, luifran wrote: > > > My operating system is ubuntu 10.04 > > > > On 13 abr, 23:39, pbreit wrote: > > > > Works OK for me on Mac Firefox 4.
[web2py] Re: submit forms to press the enter key
I will try to run on Windows XP and other browsers and I tell you. On 14 abr, 09:47, Stifan Kristi wrote: > work fine for me on ubuntu 10.10 with chrome and firefox. > > On Thu, Apr 14, 2011 at 2:42 PM, luifran wrote: > > My operating system is ubuntu 10.04 > > > On 13 abr, 23:39, pbreit wrote: > > > Works OK for me on Mac Firefox 4. > >
[web2py] Re: submit forms to press the enter key
My default browser is Firefox 4 On 13 abr, 23:05, Massimo Di Pierro wrote: > which browser? > > On Apr 13, 3:52 pm, luifran wrote: > > > > > > > > > I have observed that in simple crud forms it works the enter key, > > but crud forms with references to other tables, not working. > > I mean the following types of tables: > > db.define_table ('a ', Field ('FieldName', 'DateType')) > > db.define_table ('b', Field ('FieldName', 'DateType')) > > db.define_table ('c', Field ('a ', db.a), Field ('b ', db.b)) > > crud.create (db.c) / / In this form the enter key does not work > > > On 13 abr, 22:25, luifran wrote: > > > > With forms created with html helpers works, but crud forms not works, > > > when you press the enter key nothing happens. > > > > On Apr 13, 12:25 pm, pbreit wrote: > > > > > The regular Web2py forms should already work like that. Are they not for > > > > you? What happens when you press 'enter'?
[web2py] Re: submit forms to press the enter key
I have observed that in simple crud forms it works the enter key, but crud forms with references to other tables, not working. I mean the following types of tables: db.define_table ('a ', Field ('FieldName', 'DateType')) db.define_table ('b', Field ('FieldName', 'DateType')) db.define_table ('c', Field ('a ', db.a), Field ('b ', db.b)) crud.create (db.c) / / In this form the enter key does not work On 13 abr, 22:25, luifran wrote: > With forms created with html helpers works, but crud forms not works, > when you press the enter key nothing happens. > > On Apr 13, 12:25 pm, pbreit wrote: > > > > > > > > > The regular Web2py forms should already work like that. Are they not for > > you? What happens when you press 'enter'?
[web2py] Re: submit forms to press the enter key
With forms created with html helpers works, but crud forms not works, when you press the enter key nothing happens. On Apr 13, 12:25 pm, pbreit wrote: > The regular Web2py forms should already work like that. Are they not for > you? What happens when you press 'enter'?
[web2py] submit forms to press the enter key
How could submit the forms by pressing the enter key?
[web2py] Re: Problem with JQuery Function
I want it to affect all the forms, I use crud forms, how I can put a id for the crud forms? On 11 abr, 00:38, pbreit wrote: > Possibly because you are binding to 'form'. You might want to make the bind > more specific like this: > > > > > >
[web2py] Re: Problem with JQuery Function
I also work for me, but I stop working flash messages, calendars, tooltips, etc. I want to run everything. On 10 abr, 19:15, pbreit wrote: > But I think Web2py's standard buttons work like this without needing that > extra code.
[web2py] Re: Problem with JQuery Function
I was wrong to copy the code, is this: $ (function () { $ ("form"). bind ("keypress", function (event) { if (event.keyCode == 13) { $ ('form'). submit () } }); }); But the problem is not there. On 10 abr, 03:05, pbreit wrote: > That code snippet is missing a }.
[web2py] Problem with JQuery Function
I entered in web2py_ajax.html the following code to submit the form by pressing the Enter key: $ (function () { $ ("form"). bind ("keypress", function (event) { if (event.keyCode == 13) { $ ('form'). submit () } }); The problem is that putting this code, all effects that use jQuery, stop working, such as flash messages, calendar.js, tooltips, etc. After running the application with this code, even removing this code, still does not work. I was lucky enough to have a copy of the recent application and I could restore. What could be the problem? How could I fix it?
[web2py] Re: Restriction Fields
Thanks you, but I don´t know how to apply this to my model, is there any example? On 30 mar, 13:12, Anthony wrote: > On Tuesday, March 29, 2011 1:33:40 PM UTC-4, luifran wrote: > > > as I can do that? > > to insert into the table I use crud.create > > You can specify an onvalidation function with crud via the crud > settings:http://web2py.com/book/default/chapter/07#Settings > > onvalidation is explained in more detail > here:http://web2py.com/book/default/chapter/07#onvalidation > > Anthony
[web2py] Re: Restriction Fields
as I can do that? to insert into the table I use crud.create On Mar 29, 10:21 am, pbreit wrote: > I suspect you will need to use "onvalidation" in your controller and then > query the db for both fields matching.
[web2py] Re: Restriction Fields
I have not explained very well, I will not prevent the value of a and b are equal, I want to avoid the insertion of identical records, for example: Record 1 -> a: 4 b: 5 Record 2 -> a: 4 b: 5 This is what I want to avoid Sorry for my words, I'm Spanish, not fluent in English. On 28 mar, 20:40, luifran wrote: > Thanks, I'll try that way > > On Mar 28, 8:59 am, Massimo Di Pierro > wrote: > > > > > > > > > db.define_table ('t', Field ('a'), Field ('b',requires=IS_EXPR('value!= > > %s'% repr(request.vars.a))) > > > On Mar 28, 10:37 am, luifran wrote: > > > > I have the following table, for example: > > > db.define_table ('t', Field ('a '), Field ('b')) > > > I want to impose the following restriction, to avoid insertion of > > > duplicate records > > > not allow insertion of a pair of identical values (a y b). > > > How I can do this?, I know how to restrict a single field, but not > > > both at once.
[web2py] Re: Restriction Fields
Thanks, I'll try that way On Mar 28, 8:59 am, Massimo Di Pierro wrote: > db.define_table ('t', Field ('a'), Field ('b',requires=IS_EXPR('value!= > %s'% repr(request.vars.a))) > > On Mar 28, 10:37 am, luifran wrote: > > > > > > > > > I have the following table, for example: > > db.define_table ('t', Field ('a '), Field ('b')) > > I want to impose the following restriction, to avoid insertion of > > duplicate records > > not allow insertion of a pair of identical values (a y b). > > How I can do this?, I know how to restrict a single field, but not > > both at once.
[web2py] Restriction Fields
I have the following table, for example: db.define_table ('t', Field ('a '), Field ('b')) I want to impose the following restriction, to avoid insertion of duplicate records not allow insertion of a pair of identical values (a y b). How I can do this?, I know how to restrict a single field, but not both at once.
[web2py] save file
I used the following code to open a O.S window, to open a file, form = FORM (INPUT (_type = 'file', _name = 'data'), INPUT (_type = 'submit')), but now I want the same to save a file, how I can do?
[web2py] Re: show tables joined in jqgrid
I talk about the plugin jqgrid On 31 ene, 12:12, luifran wrote: > I can display single table in jqgrid, but, how I can display joined > tables in jqgrid?
[web2py] show tables joined in jqgrid
I can display single table in jqgrid, but, how I can display joined tables in jqgrid?
[web2py] Modify calendar.js
I would like to change the calendar.js date format, I want the format d / m / y instead ofy / m / d ¿It´s possible?
[web2py] Re: Value of the form field
Thanks, I fixed it with the next code: redirect(URL('modificar_obra',vars=dict(a=form.vars.nombre))) On 19 ene, 11:19, Kenneth Lundström wrote: > If you look at form.vars.name1 before passing them via redirect you ll > see that no replacing has been done, try with > > if form.accepts (request.vars, session): > session.flash = "Form sent" > return form.vars.name1 > > the replacing happens in the redirect because you can t have an URL with > spaces in it. If you pass name1='test ing' and test2='huu huu' you would get > an URL like > > /eliminar_prevencion_riesgos/test ing/huu huu/ and thats not allowed in > web2py. > > Kenneth > > > > > > > > > When I extract the value of a form field, if I've written for example > > "take helmet", I get the value of field `take_helmet, why? > > The code is as follows: > > > form = FORM ('name risk', > > INPUT (_name = 'name1', required = [IS_NOT_EMPTY (), > > IS_UPPER ()]), > > 'preventive action Name:', > > INPUT (_name = 'name2', required = [IS_NOT_EMPTY (), > > IS_UPPER ()]), > > INPUT (_type = 'submit')) > > form.accepts if (request.vars, session): > > session.flash = "Form sent" > > redirect (URL ('eliminar_prevencion_riesgos', args = > > (form.vars.nombre1, form.vars.nombre2))) > > > When I look at the value of variables, form.vars.name1, > > form.vars.name2, spaces between words are filled with the symbol '_'. > > How I can fix this?
[web2py] Value of the form field
When I extract the value of a form field, if I've written for example "take helmet", I get the value of field `take_helmet, why? The code is as follows: form = FORM ('name risk', INPUT (_name = 'name1', required = [IS_NOT_EMPTY (), IS_UPPER ()]), 'preventive action Name:', INPUT (_name = 'name2', required = [IS_NOT_EMPTY (), IS_UPPER ()]), INPUT (_type = 'submit')) form.accepts if (request.vars, session): session.flash = "Form sent" redirect (URL ('eliminar_prevencion_riesgos', args = (form.vars.nombre1, form.vars.nombre2))) When I look at the value of variables, form.vars.name1, form.vars.name2, spaces between words are filled with the symbol '_'. How I can fix this?
[web2py] Value of the form field
When I write two separate words in a form field, and extract the value of this field, every space appears the symbol '_', it causes me not match the field's value with the value of the database. How I can fix this? Thanks.
[web2py] Re: problem with dal
Thank you, I've fixed it with: actividad_id=actividad[0].id riesgo_id=riesgo[0].id On 15 ene, 12:45, Massimo Di Pierro wrote: > perhaps > > (db.actividades_riesgos.riesgos==riesgo) > > should be > > (db.actividades_riesgos.riesgos==riesgo.first().id) > > On Jan 15, 5:24 am, luifran wrote: > > > > > > > > > db.define_table('actividades_riesgos',Field('actividades',db.actividades),F > > ield('riesgos',db.riesgos)) > > > actividad=db(db.actividades.nombre==request.args(0)).select(db.actividades. > > id) > > riesgo=db(db.riesgos.nombre==request.args(1)).select(db.riesgos.id) > > record = db((db.actividades_riesgos.actividades==actividad) & > > (db.actividades_riesgos.riesgos==riesgo)).select().first() > > > The last line show the next error: > > TypeError: int() argument must be a string or a number, not 'Rows' //
[web2py] problem with dal
db.define_table('actividades_riesgos',Field('actividades',db.actividades),Field('riesgos',db.riesgos)) actividad=db(db.actividades.nombre==request.args(0)).select(db.actividades. id) riesgo=db(db.riesgos.nombre==request.args(1)).select(db.riesgos.id) record = db((db.actividades_riesgos.actividades==actividad) & (db.actividades_riesgos.riesgos==riesgo)).select().first() The last line show the next error: TypeError: int() argument must be a string or a number, not 'Rows' //
[web2py] run web2py application in cheyenne web server
Is it possible to run a web2py application in Cheyenne web server?