[web2py] Model and Controller with Web2Py, View with Excel ??
Hi, the combination web2py-DAL with python code (controller) and Excel to manipulate and chart table data would be wonderful. That would mean rapid prototyping with a lot of databases and the option to go to web later. So, is it possible to use „only“ the model and controller level from web2py and use Mircosoft Excel as view with for example pyxll or datanitro? (see http://www.pyxll.com and https://datanitro.com ) Is it possible to use web2py-DAL locally without a webserver? Would it be possible to use a debugger with this combination? Cheers! pd -- 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/groups/opt_out.
[web2py] Re: Create a drop-down menu from a database
Massimo, thank you very much for your example, but it does not work, here is my complete code: model: db.define_table('cities', Field('name'), Field('mystate'), format = '%(name)s' ) #db.cities.requires=IS_IN_DB(db, 'cities.id', '%(name)s')#IS_IN_DB(db,db.cities.id,'%(name)s') controller: def insertData(): if db(db.cities.id0).count() == 0: db.cities.truncate() db.cities.insert(name='Cityname1',mystate='State1') db.cities.insert(name='Cityname2',mystate='State2') db.cities.insert(name='Cityname3',mystate='State2') db.cities.insert(name='Cityname4',mystate='State3') db.cities.insert(name='Cityname5',mystate='State3') def menuFromDb(): form = SQLFORM.factory(Field('choose_city','reference cities')) #reference cities, db.cities #form = SQLFORM.factory(Field('choose_city','db.cities')) return dict(form=form) View: {{extend 'layout.html'}} {{=form}} This code produce only a simple imput box and not a drop down menu, that comes from the db as intended. I think, only one line of code is missing, but what? Thanks for your help and your great work with web2py! pd -- 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/groups/opt_out.
[web2py] Re: Example of web2py integration with an AJAX grid (preferably jquery based) which updates backend db ?
Hi Tim, thanks for your tip with the jQuery Grid code. My question referred to the code from Simon Ashley how to use jeditable, see best marked answer... This code is not on web2pysliceshttp://www.web2pyslices.com/slice/show/1714/jqgrid-viewing-and-updating-data Cheers! pd my question Am Samstag, 5. Oktober 2013 15:14:38 UTC+2 schrieb Tim Richardson: look on web2pyslices http://www.web2pyslices.com/slice/show/1714/jqgrid-viewing-and-updating-data -- 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/groups/opt_out.
[web2py] Re: Example of web2py integration with an AJAX grid (preferably jquery based) which updates backend db ?
Hi Simon, thanks for your quick answer! There is some progess, an other error message: :-) Error Message: Traceback *(*most recent call last*):* * *File /Users/myname/PycharmProjects/DataBaseExamples/web2py/gluon/restricted.py*, *line 217*, **in *restricted *exec *ccode *in *environment File /Users/myname/PycharmProjects/DataBaseExamples/web2py/applications/DataBaseExamples/controllers/jeditable.pyhttp://127.0.0.1:8000/admin/default/edit/DataBaseExamples/controllers/jeditable.py *, *line 19*, **in ***module** * *File /Users/myname/PycharmProjects/DataBaseExamples/web2py/gluon/globals.py*, *line 371*, **in lambda*** ***self**.*_caller *= **lambda *f*: *f*()* * *File /Users/myname/PycharmProjects/DataBaseExamples/web2py/applications/DataBaseExamples/controllers/jeditable.pyhttp://127.0.0.1:8000/admin/default/edit/DataBaseExamples/controllers/jeditable.py *, * line 14*, **in *upd_dog_name id*,*column *= *request*.*post_vars*.*id*.*split*(*'.'*) **#'NoneType' object has no attribute 'split'* AttributeError*: *'NoneType' object has no attribute 'split' --- Did you take the code from a working example? Thanks for your help! pd Am Sonntag, 6. Oktober 2013 03:55:50 UTC+2 schrieb Simon Ashley: Just remark out/ delete the truncate fleas line. If the 'upd_dog_name' function is not called, check installation and calling of jeditable -- 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/groups/opt_out.
[web2py] Re: Example of web2py integration with an AJAX grid (preferably jquery based) which updates backend db ?
Hi Simon, I just found the problem: The line: script src={{=URL('static','js/jquery.jeditable.js')}}/script has to be inserted after(!) {{include 'web2py_ajax.html'}} which adds jquery.js Changing that, first my inline changes were reverted, but when I adapted the location in the line jQuery('.dog_name').editable({{=URL('jeditable', 'upd_dog_name')}},{ to my location of „*upd_dog_name“* now it works perfect! Thank you very much for this wonderful example: I learned a lot with it, especially how to pass data from web2py/python to javascript and back. And this inline-editing is very useful too :-) This should be integrated into web2py and/or the quick examples! Do you have more examples of this kind? :-) Excellent! Perfect! 10 of 10 stars! Thanks a lot! pd -- 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/groups/opt_out.
[web2py] Re: Example of web2py integration with an AJAX grid (preferably jquery based) which updates backend db ?
Hi, thank you for sharing the idea and the code! When I tried the code, I had some errors: First the second line in populate does not fit to the model: #db.fleas.truncate() #AttributeError: 'DAL' object has no attribute 'fleas' Second, the dogs view shows a web2py grid, I can edit it normally. It seems that the inline-edit code upd_dog_name is never invoked? The idea is wonderful, even better when the code would work :-) Can you please check this code? Thank you for your help! Cheers! pd -- 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/groups/opt_out.
[web2py] DAL: read tagged data with handle?
Hi, here is some code, that should write and read some tags, it is a slightly different version as the code in the book (5th Edition) on page 316: The write test works, but I do not get the handle to read it back. What is wrong with this code, marked in read? Thanks for your help! Cheers! pd def writeTagTest(): a = db.tag.insert(name='red') b = db.tag.insert(name='green') c = db.tag.insert(name='blue') db.product.insert(name='Test Toy Car',tags=[a, b, c]) return dict(message=Insert ok, tag=db.tag,product=db.product) def readTagTest(): b=db(db.tag.name=='green').select().first() # gluon.dal.Rows? products = db(db.product.tags.contains(b)).select() # here products is empty? Why?? for item in products: print item.name, item.tags return dict(b=b,product=db.product,products=products) -- 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/groups/opt_out.
Re: [web2py] Re: Forcing SSL mode (on GAE)
Hi, you use the yaml configuration to force ssl, such as: handlers: - url: /youraccount/.* script: accounts.py login: required secure: always see https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Secure_URLs Cheers! pd Am Donnerstag, 7. Februar 2013 08:24:43 UTC+1 schrieb Philip Kilner: Hi, On 06/02/13 20:45, howesc wrote: if you want all requests in SSL it sounds like the best thing to me. Yes, it's working very well from my PoV - but my needs are very simple in that I want to force SSL for everything. I'm used to doing this in Apache, so haven't previously had to think about it enforcing it within the app. There was a browser-specific issue where e.g. Firefox worked immediately, but Chrome blocked the jQuery scripts from Google's CDN on the basis that they were insecure. Changing the link to the scripts to https sorted that. note that on GAE if you want to use SSL and a custom domain you have to purchase additional add-ons to the GAE service. https on the appspot.com domain is free. Understood - I'm happy withe the appspot.com URL, FWIW. -- Regards, PhilK 'a bell is a cup...until it is struck' -- 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/groups/opt_out.
[web2py] SQLFORM.smartgrid with linked tables on gae? Search query not supported, Tickets, Debugging on gae?
Hi, first: Thank you for creating web2py, I am starting to love it :-) I tried an app with a smartgrid on gae, some questions came up: 1.) How can I make the search in smartgrid work on gae (Google App Engine)? I only get the message query not supported 2.) Why does the upload for a picture file does *not* work on my mac, but it does on my iPad? Why does it depend from the OS used? On the Mac it seems to upload, 100 % for the uplaod is reached, but in the end I am getting the message: Error: Server ErrorThe server encountered an error and could not complete your request. If the problem persists, please reporthttp://code.google.com/appengine/community.html your problem and mention this error message and the query that caused it. The link for report links to https://developers.google.com/appengine/community?hl=decsw=1 Unfortunately I do not have a ticket, that leeds to question3: 3.) What do I have to configure, that the ticketing system works on gae? That tickets are created and saved in db(gae)? Is it possible that I have to create one ticket locally, that the index is created?? 4.) How can I enable debug on gae? Is there something wrong to take admin out of the excludes in the app.yaml? ( for developement :-) ) 5.) How can I make the generic views work on gae? See code below and attached, I used for testing BTW you have to move gaehandler.py from folder handlers one up (into folder web2py). Put the app.yaml on same level (in folder web2py), remember to set *your* app_spot_ID in Line 6 The path in the gae launcher have to be set to the used web2py (source!) folder. I used the source of web2py (2.6.3-stable+timestamp.2013.09.15.17.01.20 (Running on Rocket 1.2.6, Python 2.7.2), with GoogleAppEngineLauncher 1.8.4.1050 on MacOS 10.8.5 Thank you for help! Cheers! pd Here is what I tested, something very similar to the examples/database_examples (#29,#34): Here is the model: -, see example #29, see attached db.py db.define_table( 'person', Field('name'), Field('email'), format = '%(name)s') # ONE (person) TO MANY (products) db.define_table( 'product', Field('seller_id',db.person), Field('name'), Field('description', 'text'), Field('picture', 'upload', default=''), format = '%(name)s') # MANY (persons) TO MANY (purchases) db.define_table( 'purchase', Field('buyer_id', db.person), Field('product_id', db.product), Field('quantity', 'integer'), format = '%(quantity)s %(product_id)s - %(buyer_id)s') purchased = (db.person.id==db.purchase.buyer_id)(db.product.id==db.purchase.product_id) db.person.name.requires = IS_NOT_EMPTY() db.person.email.requires = [IS_EMAIL(), IS_NOT_IN_DB(db, 'person.email')] db.product.name.requires = IS_NOT_EMPTY() db.purchase.quantity.requires = IS_INT_IN_RANGE(0, 10) Here is the controller: -- see example #34, see attached database_examples.py def manage_transactions(): grid = SQLFORM.smartgrid(db.person,linked_tables=['product','purchase'], user_signature=False) return dict(grid=grid) Here is the view:-- this was not part of the examples, but I have to add it, as the generic view used otherwise does not work on gae {{extend 'layout.html'}} h1Manage Trancations/h1 p{{=grid}}/p Here is the app.yaml:- # For Google App Engine deployment, copy this file to app.yaml # and edit as required # See http://code.google.com/appengine/docs/python/config/appconfig.html # and http://web2py.com/book/default/chapter/11?search=app.yaml application: PUT_YOUR_APPSPOT_ID_HERE version: 1 api_version: 1 # use this line for Python 2.5 # #runtime: python # use these lines for Python 2.7 # upload app with: appcfg.py update web2py (where 'web2py' is web2py's root directory) # runtime: python27 threadsafe: true# true for WSGI concurrent requests (Python 2.7 only) default_expiration: 24h # for static files handlers: # Warning! Static mapping - below - isn't compatible with # the parametric router's language logic. # You cannot use them together. - url: /(.+?)/static/_\d.\d.\d\/(.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional expiration: 365d - url: /(.+?)/static/(.+) static_files: applications/\1/static/\2 upload: applications/(.+?)/static/(.+) secure: optional - url: /favicon.ico static_files: applications/welcome/static/favicon.ico upload: applications/welcome/static/favicon.ico - url: /robots.txt static_files: applications/welcome/static/robots.txt upload: applications/welcome/static/robots.txt - url: .* #script: gaehandler.py # CGI script: gaehandler.wsgiapp# WSGI (Python 2.7 only) secure: optional admin_console: pages: - name: Appstats url: /_ah/stats