[web2py] Add record button disappears when using groupby argument for SQLFORM.grid()
Hello everyone, the add record button disappears when using groupby argument for SQLFORM.grid(). Is this normal behavior? How can I work around this without implementing my own add record feature? I'd really like to stay within vanilla grid as much as possible. Please advise. -- 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: distinct keyword for SQLFORM.grid
Ok I think I solved my problem by using grid's groupby argument, thanks to this post <http://stackoverflow.com/questions/164319/is-there-any-difference-between-group-by-and-distinct> and this post. <https://groups.google.com/forum/?fromgroups=#!searchin/web2py/grid$20distinct%7Csort:relevance/web2py/glEWmYRLSWQ/Y_bEVtZfPBoJ> However a distinct argument for grid would still be great. On Wednesday, December 21, 2016 at 3:56:13 AM UTC-5, H. Das wrote: > > Hi Massimo, I think this still hasn't been added yet. > > I too am doing several inner joins with grid and I'm getting some rows > that I consider duplicates and would like to get rid of them. The most > straightforward way to remove these duplicates is perhaps calling select() > on the Set object with the distinct keyword argument, or perhaps even use > exclude() on the Rows object. To my knowledge grid does not yet have > equivalents to distinct and exclude, unfortunately. > > Will equivalents to distinct/exclude be added to grid anytime soon? I am > surprised something so advanced like grid doesn't have this. > > Or would you know another way to remove duplicates from grid? > > Please advise. > > On Wednesday, April 10, 2013 at 9:14:12 AM UTC-4, Massimo Di Pierro wrote: >> >> Please open a ticket and we can add this. >> >> On Wednesday, 10 April 2013 04:46:14 UTC-5, Calvin wrote: >>> >>> Hi >>> >>> I have been struggling with how one could get just distinct records to >>> show with SQLFORM.grid if the query passed to it involved more than one >>> table? Doing an inner join tends to generate a lot of non-unique rows and >>> hence it would be important to just filter out the unique ones. With >>> select, there is support for the distinct keyword but this is not the case >>> with SQLFORM.grid. >>> >>> Using the groupby keyword is one approach but this can get somewhat >>> tedious having to specify the fields to group by in advance and hence, I >>> would like to understand if the omission of support for distinct in >>> SQLFORM.grid is by design? >>> >>> Many thanks >>> Calvin >>> >> -- 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: distinct keyword for SQLFORM.grid
Hi Massimo, I think this still hasn't been added yet. I too am doing several inner joins with grid and I'm getting some rows that I consider duplicates and would like to get rid of them. The most straightforward way to remove these duplicates is perhaps calling select() on the Set object with the distinct keyword argument, or perhaps even use exclude() on the Rows object. To my knowledge grid does not yet have equivalents to distinct and exclude, unfortunately. Will equivalents to distinct/exclude be added to grid anytime soon? I am surprised something so advanced like grid doesn't have this. Or would you know another way to remove duplicates from grid? Please advise. On Wednesday, April 10, 2013 at 9:14:12 AM UTC-4, Massimo Di Pierro wrote: > > Please open a ticket and we can add this. > > On Wednesday, 10 April 2013 04:46:14 UTC-5, Calvin wrote: >> >> Hi >> >> I have been struggling with how one could get just distinct records to >> show with SQLFORM.grid if the query passed to it involved more than one >> table? Doing an inner join tends to generate a lot of non-unique rows and >> hence it would be important to just filter out the unique ones. With >> select, there is support for the distinct keyword but this is not the case >> with SQLFORM.grid. >> >> Using the groupby keyword is one approach but this can get somewhat >> tedious having to specify the fields to group by in advance and hence, I >> would like to understand if the omission of support for distinct in >> SQLFORM.grid is by design? >> >> Many thanks >> Calvin >> > -- 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: Value error when forcing AM/PM time with time field
Ok I found the problem. It turns out if I use IS_NOT_EMPTY(), the submitted time field values get treated like a string rather than a datetime.time object. Instead I changed requires to IS_TIME to get the intended result. On Monday, August 29, 2016 at 10:00:21 PM UTC-4, H. Das wrote: > > Hello everyone, > > I defined a simple table with time fields like so: > > db.define_table("time_block", > Field("start_time", "time", requires=IS_NOT_EMPTY()), > Field("end_time", "time", requires=IS_NOT_EMPTY()), > ) > > In jQuery I forced the time widget to show AM/PM like so: > > > jQuery.timeEntry.setDefaults({show24Hours: false, showSeconds: false}); > > > Now after I submit the form with the time say, 10:33PM, I get this error at > the bottom of the traceback: > File "C:\...\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1553, > in parse_time > time_items = list(map(int,str(value)[:8].strip().split(':')[:3])) > ValueError: invalid literal for int() with base 10: '33PM' > > It appears that AM/PM is not being recognized by dal? Is there another way to > force AM/PM in time widgets instead of the default 24-hour? > > My web2py version is Version 2.14.6-stable, I am using SQLite. > > 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] Re: Value error when forcing AM/PM time with time field
Unfortunately it doesn't look like IS_TIME has a format argument. That is odd. from the stacktrace: Field("start_time", "time", requires=IS_TIME(format="%I:%M")), TypeError: __init__() got an unexpected keyword argument 'format' On Tuesday, August 30, 2016 at 1:22:45 AM UTC-4, Dave S wrote: > > > > On Monday, August 29, 2016 at 7:00:21 PM UTC-7, H. Das wrote: >> >> Hello everyone, >> >> I defined a simple table with time fields like so: >> >> db.define_table("time_block", >> Field("start_time", "time", requires=IS_NOT_EMPTY()), >> Field("end_time", "time", requires=IS_NOT_EMPTY()), >> ) >> >> In jQuery I forced the time widget to show AM/PM like so: >> >> >> jQuery.timeEntry.setDefaults({show24Hours: false, showSeconds: false}); >> >> >> Now after I submit the form with the time say, 10:33PM, I get this error at >> the bottom of the traceback: >> File "C:\...\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1553, >> in parse_time >> time_items = list(map(int,str(value)[:8].strip().split(':')[:3])) >> ValueError: invalid literal for int() with base 10: '33PM' >> >> It appears that AM/PM is not being recognized by dal? Is there another way >> to force AM/PM in time widgets instead of the default 24-hour? >> >> My web2py version is Version 2.14.6-stable, I am using SQLite. >> >> Thanks. >> >> > > I think you need to modify your time validator: > > "This validator checks that a field value contains a valid datetime in the > specified format. It is good practice to specify the format using the > translation operator, in order to support different formats in different > locales." > http://web2py.com/books/default/chapter/29/07/forms-and-validators#Date-and-time-validators > > > (The format string details are shown with IS_DATETIME(), but should apply > to IS_DATE() and IS_TIME().) > > I think you can have that and the not-empty validator by using > requires=[...] (list notation). > > /dps > > -- 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] Value error when forcing AM/PM time with time field
Hello everyone, I defined a simple table with time fields like so: db.define_table("time_block", Field("start_time", "time", requires=IS_NOT_EMPTY()), Field("end_time", "time", requires=IS_NOT_EMPTY()), ) In jQuery I forced the time widget to show AM/PM like so: jQuery.timeEntry.setDefaults({show24Hours: false, showSeconds: false}); Now after I submit the form with the time say, 10:33PM, I get this error at the bottom of the traceback: File "C:\...\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1553, in parse_time time_items = list(map(int,str(value)[:8].strip().split(':')[:3])) ValueError: invalid literal for int() with base 10: '33PM' It appears that AM/PM is not being recognized by dal? Is there another way to force AM/PM in time widgets instead of the default 24-hour? My web2py version is Version 2.14.6-stable, I am using SQLite. 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] Re: pyDAL support for crate.io ?
They are still relatively new, as are several "NewSQL <https://en.wikipedia.org/wiki/NewSQL>" databases that promise the same things (simpler scalability of a NoSQL but with ACID guarantees). So I wouldn't say there is currently enough demand to put in all that effort, without a sponsor of course. I have contacted Crate.io's team and linked this forum post to see if they are interested. Thanks for your response as always. On Sunday, August 7, 2016 at 8:43:45 PM UTC-4, Massimo Di Pierro wrote: > > So far you are the first one to ask for it. We are happy to look at > feasibility. Do you think there is enough demand? Do you known if they (or > any other company) that may be interested in sponsoring this project? > > On Saturday, 6 August 2016 17:08:18 UTC-5, H. Das wrote: >> >> Are there any plans to support http://crate.io database? I love crate.io's >> super simple scaling settings, and it would be amazing if pyDAL supported >> it. >> > -- 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] pyDAL support for crate.io ?
Are there any plans to support http://crate.io database? I love crate.io's super simple scaling settings, and it would be amazing if pyDAL supported it. -- 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] generic.docx ?
Would it be possible in web2py to create a generic.docx (word document, odf, or similar) template that can convert from HTML? Basically it should work just like generic.pdf. Thanks, love you guys. -- 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: DAL not equal (!=) operator unexpectedly returning zero results
Thanks! On Saturday, April 23, 2016 at 2:40:46 PM UTC-4, villas wrote: > > You can't compare NULL values using <>, you need this SQL: > > SELECT id, test_field FROM test_tableWHERE *(test_field <> "test_string")* OR > *(test_field is null)* > > Therefore use this query: > *db**((db.test_table.test_field != "test_string")|**(db.test_table.test_field > == None)).count()* > > -- 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] DAL not equal (!=) operator unexpectedly returning zero results
I have a simple (SQLite) Table named *test_table*, and a simple Field called "test_field" like so: db.define_table('test_table', Field('test_field') ) Now when I populate this table in shell (or the app), and I try to do a query with (!=), something very weird and unexpected happens... *web2py Web Framework* *Created by Massimo Di Pierro, Copyright 2007-2016* *Version 2.14.5-stable+timestamp.2016.04.14.03.26.16* *Database drivers available: pymysql, imaplib, sqlite3, pg8000, pyodbc, pymongo* *2016-04-23 13:27:01,023 - web2py - WARNING - import IPython error; use default python shell* *Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32* *Type "help", "copyright", "credits" or "license" for more information.* *(InteractiveConsole)* >>> db.test_table.insert() 1L >>> db.test_table.insert() 2L *>>> db(db.test_table.test_field != "test_string").count()* *0* >>> db(db.test_table.id > 0).count() 2 Am I crazy, or shouldn't the first query result in *2 as well*? Note, the query seems to work perfectly fine if I set the test_field's default value to an empty 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] How to make Autocomplete widget limit results based on previous fields?
Hi, Currently I have a table defined like so: db.define_table("patient", Field('first_name'), Field('last_name'), Field('date_of_birth', 'date'), ) db.patient.first_name.widget=SQLFORM.widgets.autocomplete(request, db.patient.first_name, limitby=(0,10), min_length=1) db.patient.last_name.widget=SQLFORM.widgets.autocomplete(request, db.patient.last_name, limitby=(0,10), min_length=1) db.patient.date_of_birth.widget=SQLFORM.widgets.autocomplete(request, db.patient.date_of_birth, limitby=(0,10), min_length=1) I'd it to be that, after I type in the first_name form field, when I type in the last_name form field, the auto-complete results for last_name should be limited to rows where db.patient.first_name == . Is there any way to customize the Autocomplete widget to do this? 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] Re: Sending email w/ text & html
Hi can you try: mail.send(to='y...@example.com', subject=subject, message=msg, headers={'Content-Type' : 'text/html'}) On Tuesday, April 12, 2016 at 8:28:56 PM UTC-4, Scott Hunter wrote: > According to the current book, I should be able to do this: > > mail.send('y...@example.com ', > 'Message subject', > ('Plain text body', 'html body')) > > > When I try: > > msg = ("Text only","HTML Only") > mail.send(to='y...@example.com ', > subject=subject, message=msg ) > > > the text part does not appear in the received email, only the HTML part. > > Is this a bug, or am I mis-reading the documentation? > -- 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: How to add CSS classes to auth.login custom?
Use jQuery: script $('form').attr({class:my-class}); /script On Wednesday, February 27, 2013 4:20:26 PM UTC-5, Chris wrote: Hello, I have a form that looks like this: {{top_login_form = auth.login(next = page_currentPath_get(request))}} {{top_login_form.elements('form')[0]['_class'] = 'login_form'}} {{=top_login_form.custom.begin}} Trouble is, auth.login calls SQLFORM and sets custom.begin before the '_class' attribute takes effect, and auth.login doesn't take custom attributes. It seems like the long term solution might be to have custom.begin be a method - in the meantime I'm probably going to overwrite custom.begin myself. Any suggestions? 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] Re: CAS Auth redirect loop
I have the same problem too. I'm using custom auth_user table, as well as a custom decorator. After a new user registration, the browser returns a 310 error. I have to remove this custom decorator from *every *controller function for the problem to disappear during new registrations. This is very frustrating. Please help. On Wednesday, August 17, 2011 2:36:45 PM UTC-4, Bruno Codeman wrote: Hi again, everyone. Does anyone know why a CAS auth could be entering a loop redirect? -- Bruno de Oliva Bemfica *Engenheiro de Software* MSN: brunoc...@live.com javascript: Mobile: +55 11 8457-0978 http://www.devfranca.com.br http://www.brunobemfica.net http://www.codigofree.net --
[web2py] possible bug with oauth20 facebook: auth.settings.login_next ignored in 1.84.4
Hi, I think oauth20 ignores the url set for auth.settings.login_next (and maybe logout_next too?) in web2py 1.84.4; this wasn't the case in the previous version. Any ideas? Also, where can I find previous src's of web2py? Thanks :-)
[web2py] Re: possible bug with oauth20 facebook: auth.settings.login_next ignored in 1.84.4
thank you both. On Sep 14, 4:34 pm, H. Das himel.p@gmail.com wrote: Hi, I think oauth20 ignores the url set for auth.settings.login_next (and maybe logout_next too?) in web2py 1.84.4; this wasn't the case in the previous version. Any ideas? Also, where can I find previous src's of web2py? Thanks :-)
[web2py] Re: possible error bug with oauth20 facebook documentation logout, respectively
Since OAuthAccount is required to be subclassed anyway, I just overrided the old loggout_url method with the new one in trunk. Works great! :-) Thanks Michele. On Sep 13, 9:11 am, Michele Comitini michele.comit...@gmail.com wrote: 2010/9/13 Albert Abril albert.ab...@gmail.com: So, the helloFacebook app works in trunk, and not in current yet? yes, you can make it work with current, but redirection (i.e. the next parameter in logout_url/login_url) is not supported by Auth class in a proper way in current (1.83.2) On Mon, Sep 13, 2010 at 11:32 AM, Michele Comitini michele.comit...@gmail.com wrote: Yes it is correct, in trunk you can find: def logout_url(self, next=/): del self.session.token return next 2010/9/13 H. Das himel.p@gmail.com: Hi, in the documentation for oauth20 facebook section in chapter 8, the following correction should be made: # import required modules from facebook import GraphAPI, GraphAPIError (the import of GraphAPIError is missing in the documentation) Also, i noticed that logging out when using this method doesn't work properly all the time... I get redirected to a page that says 'None'. I think making the following correction to a method in oauth20_account.py solves that: def logout_url(self, next=/): return next Am I correct? I'm not as skilled as most of you here, so I could be wrong ;-)
[web2py] possible error bug with oauth20 facebook documentation logout, respectively
Hi, in the documentation for oauth20 facebook section in chapter 8, the following correction should be made: # import required modules from facebook import GraphAPI, GraphAPIError (the import of GraphAPIError is missing in the documentation) Also, i noticed that logging out when using this method doesn't work properly all the time... I get redirected to a page that says 'None'. I think making the following correction to a method in oauth20_account.py solves that: def logout_url(self, next=/): return next Am I correct? I'm not as skilled as most of you here, so I could be wrong ;-)