[web2py] Re: distinct based on more than 1 field
This works indeed, and I can build an SQLTABLE based on the rows now. Thank you. Consequence is that SQLFORM.grid or smart grid cannot be used in this case? (since there is no select statement possible, as it just takes a query?) Op zaterdag 27 juni 2015 22:47:34 UTC+2 schreef villas: I think you need to use the distinct like this: rows = db(q).select(db.person.firstname, db.person.familyname, distinct=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] distinct based on more than 1 field
db person with 2 fields: db.define_table('person', Field('firstname', type='string'), Field('familyname', type='string'), . ) Need to make this table visible in SQLFORM.grid / SQLFORM.smartgrid, or SQLTABLE based on a JOIN query: q = ((db.person.id == db.othertable.person_fk)) rows = db(q).select(db.person.firstname, db.person.familyname) Due to the JOIN, several rows have the same person, but every person may be displayed only once. So tried this: t = SQLTABLE(rows, *distinct = True*) But still the same person is shown several times in the table. In fact I need the combination of firstname + familyname to be distinct. I read in the book that distinct can also be an expression. Can this help in this case? And then what is the syntax? Thank you for your help -- 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: set of rows as input to smart grid
Indeed, thx! More general question: since there is no SELECT() call: how can SELECT() arguments such as DISTINCT be applied here? Op donderdag 25 juni 2015 05:29:32 UTC+2 schreef Michael Beller: You can pass a list of fields using the 'fields' arg of smartgrid -- 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] set of rows as input to smart grid
Typically, smartgrid takes a query as argument. But what if that query is the result of a join where some fields may not be displayed in the smart grid? Example: q = ((db.t1.f1 == db.t2.f21) (db.t2.f22 == db.t3.f3)) grid=SQLFORM.smartgrid(db.t1, constraints = dict(t1=query)) return locals() What if we want to display in the smart gird ONLY fields of t1? DJ -- 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: Unable to join more than one table in SQLForm.grid
Interesting indeed, this solves my similar problem as well, but how can I force 'distinct=True' in this context? 'distinct' would be specified in a select() statement, but that cannot be done here? Context: I have a complex query combining 3 tables with joins, but I only want to show the fields of 1 table in a smart grid. On top, only unique records shall be shown. This seems not obvious, as smart grid cannot handle sets, but when passing a query then the select function cannot be called? -- 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: GAE SDK: Getting ImportError for gluon.contrib.populate import populate
I have the same issue So what did you do about this? Thx Davy Op maandag 13 augustus 2012 12:53:10 UTC+2 schreef Jaymin Oh: I just found by myself. populate method in db.py doesn't support in GAE. On Thursday, September 29, 2011 6:52:16 PM UTC+9, glomde wrote: Hi, I am trying to use GAE but I get import error on populate in db_wizard_populate.py. It seems to do with the restricted environment. Do anybody know how to fix this? The traceback is: Traceback (most recent call last): File /home/g/web2py/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/g/web2py/applications/myapp2/models/ db_wizard_populate.py, line 3, in module from gluon.contrib.populate import populate File /home/g/web2py/gluon/custom_import.py, line 280, in __call__ fromlist, level) File /home/g/web2py/gluon/custom_import.py, line 74, in __call__ level) ImportError: No module named populate -- 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: Submit FORM not working in IE11
Problem seems to be linked to the surrounding page in which the page is displayed. Not just linked to the browser, although IE seems to suffer more than others. I have reduced the surrounding page from 3 cols to 1 col and it works in all browsers now. DJ Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops: My web2py app is ready, and I was about to deploy, but just found out it doesn't work at al under Internet Explorer 11! I developed everything using safari, chrome also tested in firefox. All working fine. But I have a form (generated via SQLFORM.factory) with a submit button. Using IE11: when pushing the SUBMIT button, is says working very briefly, but then nothing at all happens. I cannot test if older IE versions have the same problem. Are there any special tricks to be applied for IE? Thank you for your help DJ -- 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: Submit FORM not working in IE11
I am trying to isolate the problem. Situation: the web2py form is embedded in an iframe on drupalgardens site. The web2py server is on Amazon EC2 machine running ubuntu. What I found out so far: When I take a PC (mac, windows, it doesn't matter) with any browser (IE, safari for sure), then at first the popups and the submit actions are NOT working. The submit button says working for a second and then nothing happens. BUT if I then play around with that PC for a while, and surf directly to the ubuntu server (without iframe), possibly loggin in, then suddenly the popups and submit button start working. When I then try it on that same PC with the iframe, it works as well (from the drupalgardens site). Seems that something needs to pass a gate once and then it works for that PC. certificates?? Still root cause is unknown. My site is not deployable like this :( DJ When I use a Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops: My web2py app is ready, and I was about to deploy, but just found out it doesn't work at al under Internet Explorer 11! I developed everything using safari, chrome also tested in firefox. All working fine. But I have a form (generated via SQLFORM.factory) with a submit button. Using IE11: when pushing the SUBMIT button, is says working very briefly, but then nothing at all happens. I cannot test if older IE versions have the same problem. Are there any special tricks to be applied for IE? Thank you for your help DJ -- 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] Submit FORM not working in IE11
My web2py app is ready, and I was about to deploy, but just found out it doesn't work at al under Internet Explorer 11! I developed everything using safari, chrome also tested in firefox. All working fine. But I have a form (generated via SQLFORM.factory) with a submit button. Using IE11: when pushing the SUBMIT button, is says working very briefly, but then nothing at all happens. I cannot test if older IE versions have the same problem. Are there any special tricks to be applied for IE? Thank you for your help DJ -- 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: Submit FORM not working in IE11
Seems other users with Safari have a similar problem with my form, so possibly this is not browser related. Maybe some cookie / authentication issue is in play here? Op dinsdag 25 februari 2014 21:55:42 UTC+1 schreef Davy Jacops: My web2py app is ready, and I was about to deploy, but just found out it doesn't work at al under Internet Explorer 11! I developed everything using safari, chrome also tested in firefox. All working fine. But I have a form (generated via SQLFORM.factory) with a submit button. Using IE11: when pushing the SUBMIT button, is says working very briefly, but then nothing at all happens. I cannot test if older IE versions have the same problem. Are there any special tricks to be applied for IE? Thank you for your help DJ -- 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: web2py multiple records in 1 form or in wizard
Massimo Thank you for your suggestion. In fact the code suggested gives an error: SyntaxError: Object exists and cannot be redefined: PersonName But your hint pointed me in the right direction. The following works: def reserve(): form = SQLFORM(db.reservations) * form.vars.PersonName = session.PersonName* if form.process().accepted: session.PersonName = form.vars.PersonName return dict(form=form) Thanks again Davy Op zaterdag 25 januari 2014 22:49:45 UTC+1 schreef Massimo Di Pierro: You can use session to pre-populate the form. def reserve(): db.reservations.PersonName = session.PersonName form = SQLFORM(db.reservations) if form.process().accepted: session.PersonName = form.vars.PersonName return dict(form=form) On Friday, 24 January 2014 23:47:08 UTC-6, Davy Jacops wrote: In web2py, making a ticket reservation form Simplified db view: db.define_table('shows', Field('ShowName', 'string')) db.define_table('reservations', Field('PersonName','string'), Field('NbrOfTickets','integer'), Field('show_id',db.shows)) db.reservations.show_id.requires = IS_IN_DB(db, db.shows.id, '%(ShowName)s') When making a reservation: People need to first fill their name, then select a show from a drop-down and amount of tickets. All this works fine, BUT: I want people to be able to make reservations for more than 1 show! But people don't like to fill their name more than once... *So the question is: how can I make a form (or wizard) which allows people to fill out only once their name, and then get the possibility to fill out several (amount unknown upfront) forms where they select 1 show + amount of tickets.* If all this can be done without wizard, also fine for me. Thank you for your help! -- 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] web2py multiple records in 1 form or in wizard
In web2py, making a ticket reservation form Simplified db view: db.define_table('shows', Field('ShowName', 'string')) db.define_table('reservations', Field('PersonName','string'), Field('NbrOfTickets','integer'), Field('show_id',db.shows)) db.reservations.show_id.requires = IS_IN_DB(db, db.shows.id, '%(ShowName)s') When making a reservation: People need to first fill their name, then select a show from a drop-down and amount of tickets. All this works fine, BUT: I want people to be able to make reservations for more than 1 show! But people don't like to fill their name more than once... *So the question is: how can I make a form (or wizard) which allows people to fill out only once their name, and then get the possibility to fill out several (amount unknown upfront) forms where they select 1 show + amount of tickets.* If all this can be done without wizard, also fine for me. Thank you for your help! -- 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] web2py multiple records in 1 form or in wizard
In web2py, making a ticket reservation form Simplified db view: db.define_table('shows', Field('ShowName', 'string')) db.define_table('reservations', Field('PersonName','string'), Field('NbrOfTickets','integer'), Field('show_id',db.shows)) db.reservations.show_id.requires = IS_IN_DB(db, db.shows.id, '%(ShowName)s') When making a reservation: People need to first fill their name, then select a show from a drop-down and amount of tickets. All this works fine, BUT: I want people to be able to make reservations for more than 1 show! But people don't like to fill their name more than once... *So the question is: how can I make a form (or wizard) which allows people to fill out only once their name, and then get the possibility to fill out several (amount unknown upfront) forms where they select 1 show + amount of tickets.* If all this can be done without wizard, also fine for me. Thank you for your help! -- 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.