[web2py] Re: Extract Models from MS SQL Server

2016-06-20 Thread Kyle Flanagan
ts says the following: > > USAGE: extract_mssql_models db host port user passwd > Call with SQL Server database connection parameters, > web2py model will be printed on standard output. > EXAMPLE: python extract_mssql_models.py mydb localhost 3306 kflanaga pass > or > python ext

[web2py] Extract Models from MS SQL Server

2016-06-16 Thread Kyle Flanagan
and default values * Supports running from the command line as well as from an IDE's debug menu. See the COMMAND_LINE_MODE constant below * for more info. Requirements: * Needs pyodbc python connector Created by Kyle Flanagan. Based on a script by Mariano Reingart which was ba

[web2py] Re: SQLFORM.grid order of fields on create or edit form

2015-04-22 Thread Kyle Flanagan
Thanks Niphlod, that did the trick. I did the same for createargs as well. Normally, I would just reorder the fields in the table def and go on with life, but in this case, I have a set of base fields that a handful of my tables share. I needed one of these base fields to be first and another t

[web2py] SQLFORM.grid order of fields on create or edit form

2015-04-21 Thread Kyle Flanagan
I know you can specify the order of fields for the main view of an SQLFORM.grid using the optional fields parameter, however, whenever you choose to add a new record, the order seems to be dictated by the order in which the fields were created in the table definition. Is there a way to explicit

[web2py] Re: Customize SQLFORM.grid view page and add custom "Back" button

2014-09-23 Thread Kyle Flanagan
nd then did the following at the top of the view for "view" pages: {{=back_button}} On Tuesday, September 23, 2014 11:12:14 AM UTC-5, Kyle Flanagan wrote: > > I have a controller that creates a grid off of a table -- very basic grid. > I test to see if the user is "vie

[web2py] Customize SQLFORM.grid view page and add custom "Back" button

2014-09-23 Thread Kyle Flanagan
I have a controller that creates a grid off of a table -- very basic grid. I test to see if the user is "viewing" an item in the grid (if request.args and request.args[0] == 'view') and if so, I customize the view to present the information in the grid in a different layout. Now, I'd like to ad

[web2py] Re: Getting all rows from SQLFORM.grid

2014-05-07 Thread Kyle Flanagan
ds of records? Anyway, in > the case of a search, you can always set "paginate" to be sufficiently high: > > grid = SQLFORM.grid(..., paginate=200 if request.get_vars.keywords else 20 > ) > > Anthony > > On Wednesday, May 7, 2014 1:46:26 PM UTC-4, Kyle Flanagan wrote: &g

[web2py] Getting all rows from SQLFORM.grid

2014-05-07 Thread Kyle Flanagan
Is there a straightforward way to get a Rows object representing ALL the rows referred to by SQLFORM.grid? Something similar to grid.rows, which is good, but it only gives a Rows object with the rows currently being displayed on that page. I'd like to allow the user to search using the grid,

[web2py] Storing Files on the Filesystem

2014-05-06 Thread Kyle Flanagan
Is there an appropriate web2py way to write to the filesystem? My ultimate goal is to have a custom export class for SQLFORM.grid which will allow the user to download a CSV of the data, but also store a copy of that CSV file on the file system for use by other applications on the same web ser

[web2py] Re: Using Date Fields in Compute Field Causes Error on CSV Upload

2014-05-06 Thread Kyle Flanagan
= id_map[field.type[9:].strip()][long(value)] except KeyError: pass elif id_offset and field.type.startswith('reference'): try: value = id_offset[field.type[9:].strip()]+long(value) except K

[web2py] Re: links to specific records in table

2014-05-06 Thread Kyle Flanagan
It's normally a good idea to construct your SQLTABLE in your controller and then pass it to your view, e.g.: default.py def index(): query = db().select() table = SQLTABLE(query,headers='fieldname:capitalize', linkto= 'table_manage') default/index.html {{extend 'layout.html'}} {{=tab

[web2py] Re: db.bookings.start_date.default = ('%s-%s-%s') % (start_day, start_month, start_year)

2014-05-06 Thread Kyle Flanagan
Try the following: import datetime db.bookings.start_date.default = datetime.date(start_year, start_month,start_day ) Since start_date is the 'date' datatype, it's expecting a python datetime object. On Tuesday, May 6, 2014 4:22:46 AM UTC-5, Stefan van den Eertwegh wrote: > > Hi all, > > I hav

[web2py] Using Date Fields in Compute Field Causes Error on CSV Upload

2014-05-05 Thread Kyle Flanagan
I'm encountering an error when uploading a CSV file when dates are involved in a computed field. Using sqlite, web2py version: 2.8.2-stable+timestamp.2013.11.28.13.54.07 (also tested on 2.9.5-stable+timestamp.2014.03.16.02.35.39). E.g., consider the following table definition in a model: db.de

[web2py] Re: Adding elements (e.g. a button) to SQLFORM.grid

2014-01-02 Thread Kyle Flanagan
of the grid and therefore should give you no styling issues. > > > On Wednesday, 1 January 2014 05:33:23 UTC+11, Kyle Flanagan wrote: >> >> I'm using a table to hold temporary information from a user. I use >> SQLFORM.grid to present this table. What I'd li

[web2py] Re: 2nd page of results don't show up on my SQLFORM.grid

2013-12-31 Thread Kyle Flanagan
My web2py experience is limited, but it seems you're losing your form.vars.lname variable when you navigate to the next page. You'll need to assign it to a request.vars, session, or some other persistent variable and then use that to build your query instead of form.vars.lname. On Tuesday, De

[web2py] Adding elements (e.g. a button) to SQLFORM.grid

2013-12-31 Thread Kyle Flanagan
I'm using a table to hold temporary information from a user. I use SQLFORM.grid to present this table. What I'd like to do is add a submit button below the table that calls my submit function. If I try adding an extra element in the controller according to the book (http://web2py.com/book/defau

[web2py] Re: Can somebody help me to integrate Web2Py on Hostagtor?

2013-12-31 Thread Kyle Flanagan
Paulo, I spent probably 48+ hours trying to get web2py running on hostgator with no success. I tried pretty much every shared hosting guide out there, opened a ticket with hostgator, had them work on it, but with no luck. I don't mean to discourage you, and if you successfully get it up and ru

[web2py] Re: RFC: validator IS_NOT_IN_SET

2013-08-09 Thread Kyle Flanagan
I had to use this today. However, this does not work correctly when the set is empty. We assume that if the set is empty, whatever variable value being tested is not in the set. Here's an updated __call__ function: def __call__(self, value): value, error = IS_IN_SET.__call__(self,

[web2py] Re: SQLFORM.grid field_id not persistent when sorting on grid headers

2013-08-09 Thread Kyle Flanagan
Fixed by revision https://code.google.com/p/web2py/source/detail?r=64ffb31906d8. Thanks niphlod and mdpierro. On Thursday, August 8, 2013 4:27:35 PM UTC-5, Kyle Flanagan wrote: > > I submitted this as a ticket (1622), but it may be more appropriate to be > addressed here. > &g

[web2py] Re: SQLFORM.grid field_id not persistent when sorting on grid headers

2013-08-09 Thread Kyle Flanagan
Both 2.4.6-stable+timestamp.2013.04.06.17.37.38 and 2.6.0-development+timestamp.2013.08.09.11.04.59 On Friday, August 9, 2013 2:39:49 AM UTC-5, Massimo Di Pierro wrote: > > Which web2py version? > > On Thursday, 8 August 2013 16:27:35 UTC-5, Kyle Flanagan wrote: >> >&g

[web2py] Re: Pass python list back to controller

2013-08-08 Thread Kyle Flanagan
; E.g. session.serials = [] and then session.serials.append(x) > > Ykä > > On Thursday, July 18, 2013 6:55:52 PM UTC+3, Kyle Flanagan wrote: >> >> What's the best way to pass a Python list back to the controller, i.e. >> keep the list object persistent between calls? The list could

[web2py] Changing SQLFORM.grid/container width default size

2013-07-23 Thread Kyle Flanagan
I'm trying to change the width of an SQLFORM.grid to take up the full width of the browser window, but only in one view. I'm assuming that means I need to change the .container width, but I can't figure out where exactly the width needs to be changed. I've also read that changing container to c

[web2py] Pass python list back to controller

2013-07-18 Thread Kyle Flanagan
What's the best way to pass a Python list back to the controller, i.e. keep the list object persistent between calls? The list could get quite large so I'm not sure if request.args or request.vars is appropriate for it (well the items in the list)? The code below is a mockup of what I'm trying t

[web2py] SQLFORM.grid ondelete

2013-06-28 Thread Kyle Flanagan
I have an SQLFORM.grid w/ an ondelete calling a function customer_delete(). However, the the function is not being called and the records are not actually being deleted from the DB. If I remove the "ondelete=customer_delete" in my grid args, the records are being deleted. The way I understand i

[web2py] Re: SQLFORM.grid and joins

2013-02-27 Thread Kyle Flanagan
Have you taken a look at the field_id parameter for grid? field_id must be the field of the table to be used as ID, for example > db.mytable.id. SQLFORM.grid(..., field_id = db.item.id,...) might be what you're looking for if I'm understanding your correctly. http://web2py.com/books/default/

[web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Kyle Flanagan
Those were the only changes that I remember. I've packed up the changes I made to your app and attached them, just in case there's something I don't remember changing. I've also attached a screenshot of where I see "Medical" to make sure we're on the same page about what you're trying to accompl

[web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-25 Thread Kyle Flanagan
Alex, I downloaded your app and ran it. If I understand you correctly, you're trying to get "Medical" to show up instead of "1" when you navigate to Humanlanguages -> English -> Dictionarytypes -> Words? I achieved this by editing your db.py to the following: ##... ## Dictionary type means wha

Re: [web2py] Re: Smartgrid: How to display value from foreign table in a table when only foreign key is in table

2013-02-22 Thread Kyle Flanagan
Have you tried adding a format to your tables and defining your tables using objects instead of 'reference...'? I'm no web2py expert by any means, but I had a similar situation and when I changed the reference for my foreign id to db.other_table instead of 'reference other_table,' the format de

[web2py] How to correctly link from a grid to a smartgrid? Getting 404 NOT FOUND

2013-02-22 Thread Kyle Flanagan
I'm getting a 404 NOT FOUND error whenever I try to use a smartgrid which is linked to from a grid. I just started using web2py about two days ago, so I might be totally missing something here. I currently have an SQLFORM.grid on one page with a link to another smartgrid. The link is defined in