[web2py] How to add variable in function which called inside ajax function
Hello! It's work and I have my data. function showConcursInfo(data) { console.log(data); } ajax('{{=URL("load_additional_info")}}', ['foOne','facOne','cgOne','prOne'], showConcursInfo); But when I want to add variable in showConcursInfo() like that I saw only b and data - undefined function showConcursInfo(b,data) { console.log(b); console.log(data); } var b = 'test'; ajax('{{=URL("load_additional_info")}}', ['foOne','facOne','cgOne','prOne'], showConcursInfo(b)); -- 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: Form submit takes too long
Apart from the obvious problem Anthony pointed. Are you using sqlite in a highly concurrent environment? -- 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] Pagination with web2py_utils
Hello.I used web2py_utils package to display paging. in controller: def weblog(): query= db.post.id > 0 orderby = ~db.post.created_on paginate = web2py_utils.paginate.Pagination(db, query, orderby ,display_count=2,r=request, res=response) posts=paginate.get_set(set_links=True) return dict(posts=posts) in view: {{=response.paginate_links[0]}} {{=response.paginate_links[2]}} {{=response.paginate_links[1]}} result: I added a screenshot I'm going to translate or replace outgoing strings. For example, I want next() to be «بعدی».Thanks for advising how to change this string. -- 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: select all in grid and smargrid?
Its not working like toggle though On Tuesday, March 12, 2013 at 6:44:09 AM UTC+5:30, Massimo Di Pierro wrote: > > select > all > > On Monday, 11 March 2013 19:01:50 UTC-5, Jack wrote: >> >> Hi all, >> >> I was playing around with selectables in the grid and smartgrid and found >> this example code in the mailing list: >> >> selectable = lambda ids: delete(ids) >> form=SQLFORM.grid(query, >> selectable=selectable) >> >> def delete(ids): >> to_delete=db(db.tabla.id.belongs(ids)) >> to_delete.delete() >> >> >> It enables a checkbox in front of each row and a button to delete the >> selected rows. This is working as expected but I was wondering is there a >> way to enable a select all checkbox? >> I did some search but couldn't find anything. Is there something I'm >> missing? >> >> Thanks >> > -- 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] reference gives error table company has no column named....
I have a database which i recently updated by adding a new table called *tlamelo*, the new table is referenced in one of the old tables called *company, *when i try to save data into the table *company* i get the error bellow *(table company has no column named tlamelo)!* I do not understand why i am getting this error, i am not sure if it has anything to do with the fake_migrate=True or not! Can anyone please help me, thank you. table company has no column named tlamelo This is the code for my table tlamelo db.define_table('tlamelo', Field('leina_la_tlamelo', requires=IS_NOT_EMPTY()), format='%(leina_la_tlamelo)s', migrate=False, fake_migrate= True) This is the code for my table company db.define_table('company', Field('logo', 'upload'), Field('company_name', requires=IS_NOT_EMPTY()), Field('services', 'reference services'), Field('tlamelo', 'reference tlamelo'), #tlamelo is referenced here Field('product', 'reference product'), Field('tel', requires=IS_NOT_EMPTY()), Field('email', requires=IS_NOT_EMPTY()), Field('fax', requires=IS_NOT_EMPTY()), Field('cell', requires=IS_NOT_EMPTY()), Field('facebook', requires=IS_NOT_EMPTY()), Field('twitter', requires=IS_NOT_EMPTY()), Field('website', requires=IS_NOT_EMPTY()), Field('postal_address', requires=IS_NOT_EMPTY()), Field('located_at', requires=IS_NOT_EMPTY()), migrate=False, fake_migrate=True) -- 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 does not exist or access denied error connecting web2py to MS SQL server
I've read the book & plenty else offered by up on the little pits available on Prof. Google. And I just don't get it I guess. I'm on a Windows 10 Pro x64 box I'm running web2py from cmd as: """ cd c:\web2py python web2py web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2018 Version 2.17.1-stable+timestamp.2018.08.06.01.02.56 Database drivers available: sqlite3, imaplib, pyodbc, pymysql please visit: http://127.0.0.1:8000/ starting browser... """ I do have python 2.7.15 installed as c:\python27; also have c:\anaconda3 installed but for this purposes I break anaconda by renaming the c:\anaconda3 to c:\X-anaconda3. I validate that running python from cmd it is opening 2.7.15 as expected given the environment path. - C:\web2py>python Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>import pypyodbc >>> import pyodbc Traceback (most recent call last): File "", line 1, in ImportError: No module named pyodbc >>> - Importing pypyodbc doesn't report any problems. I believe the traceback below perfect proves 2.7.15 is running and expectedly calling the pypyodbc installed within 2.7.15. Importing pyodbc shows the error demonstrated above even thought web2py reports it as an available driver. I have no problems accessing the test DB from SSMS or other applications. SQL server is dev edition 2017. My web2py application is called 'init'. Why does this configuration of pydal fail? What more info can I offer you in this thread to get this fixed? Any tips appreciated. --- from applications\init\private\appconfig.ini -- ; db configuration [db] uri = mssql://sa:blabla@localhost/test migrate = true pool_size = 10 Traceback (most recent call last): File "C:\web2py\gluon\restricted.py", line 219, in restricted exec(ccode, environment) File "C:/web2py/applications/init/models/db.py", line 36, in check_reserved=['all']) File "C:\web2py\gluon\packages\dal\pydal\base.py", line 170, in __call__ obj = super(MetaDAL, cls).__call__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\base.py", line 475, in __init__ "Failure to connect, tried %d times:\n%s" % (attempts, tb) RuntimeError: Failure to connect, tried 5 times: Traceback (most recent call last): File "C:\web2py\gluon\packages\dal\pydal\base.py", line 455, in __init__ self._adapter = adapter(**kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in __call__ obj = super(AdapterMeta, cls).__call__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 31, in __init__ driver_args, adapter_args, do_connect, after_connection) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 369, in __init__ super(SQLAdapter, self).__init__(*args, **kwargs) File "C:\web2py\gluon\packages\dal\pydal\adapters\base.py", line 53, in __init__ self.reconnect() File "C:\web2py\gluon\packages\dal\pydal\connection.py", line 172, in reconnect self.connection = self.connector() File "C:\web2py\gluon\packages\dal\pydal\adapters\mssql.py", line 81, in connector return self.driver.connect(self.cnxn, **self.driver_args) File "c:\Python27\lib\site-packages\pypyodbc.py", line 2454, in __init__ self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly) File "c:\Python27\lib\site-packages\pypyodbc.py", line 2507, in connect check_success(self, ret) File "c:\Python27\lib\site-packages\pypyodbc.py", line 1009, in check_success ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi) File "c:\Python27\lib\site-packages\pypyodbc.py", line 987, in ctrl_err raise DatabaseError(state,err_text) DatabaseError: (u'08001', u'[08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.') -- 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: reference gives error table company has no column named....
fake_migrate makes pyDAL think the model definition reflects the actual schema in the database. Presumably the field in question does not actually exist in the database. If that's the only field missing from the database, do the following: 1. Delete the *.table file for this table in the /databases folder. 2. Comment out the line defining the missing field. 3. Leave fake_migrate=True and run one request -- that will re-create the *.table file, but without the missing field, so pyDAL will know to add the field in the next real migration. 4. Remove fake_migrate everywhere -- you don't need it unless you are correcting a migration problem. 5. Set migrate=True. 6. Remove the comment from #2 above and run another request -- pyDAL will now create the missing field. Anthony On Thursday, August 30, 2018 at 4:13:02 PM UTC-4, mostwanted wrote: > > I have a database which i recently updated by adding a new table called > *tlamelo*, the new table is referenced in one of the old tables called > *company, > *when i try to save data into the table *company* i get the error bellow > *(table > company has no column named tlamelo)!* I do not understand why i am > getting this error, i am not sure if it has anything to do with the > fake_migrate=True > or not! Can anyone please help me, thank you. > > table company has no column named > tlamelo > > This is the code for my table tlamelo > db.define_table('tlamelo', > Field('leina_la_tlamelo', requires=IS_NOT_EMPTY()), > format='%(leina_la_tlamelo)s', migrate=False, fake_migrate > =True) > > This is the code for my table company > db.define_table('company', > Field('logo', 'upload'), > Field('company_name', requires=IS_NOT_EMPTY()), > Field('services', 'reference services'), > Field('tlamelo', 'reference tlamelo'), #tlamelo is > referenced here > Field('product', 'reference product'), > Field('tel', requires=IS_NOT_EMPTY()), > Field('email', requires=IS_NOT_EMPTY()), > Field('fax', requires=IS_NOT_EMPTY()), > Field('cell', requires=IS_NOT_EMPTY()), > Field('facebook', requires=IS_NOT_EMPTY()), > Field('twitter', requires=IS_NOT_EMPTY()), > Field('website', requires=IS_NOT_EMPTY()), > Field('postal_address', requires=IS_NOT_EMPTY()), > Field('located_at', requires=IS_NOT_EMPTY()), migrate= > False, fake_migrate=True) > > > -- 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.