[web2py] How do I query and display Authors and their respective books

2023-10-10 Thread Moiz Nagpurwala
Hello, I have 2 tables in my database, one for Author and another for Book. I want to display all Author names as H2 and below each Author I want to display the books for that Author. Please suggest the query and html view code for above scenario. Thanks and regards. -- Resources: -

[web2py] Re: How to implement Gmail Authentication

2015-04-09 Thread Moiz Nagpurwala
Thanks a lot. I will surely give it a try. -- 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

[web2py] Re: How to implement Gmail Authentication

2015-04-07 Thread Moiz Nagpurwala
Hello, Still waiting for a working example of OAuth2 with Google. It is very crucial for my application to integrate Google authentication in order to succeed. Hope this great community won't let me down. Thanks and regards. -- Resources: - http://web2py.com - http://web2py.com/book

Re: [web2py] Re: How to implement Gmail Authentication

2015-03-19 Thread Moiz Nagpurwala
Any working example of OAuth2 with Google please. The documentation only describes Facebook integration. 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

Re: [web2py] how to change the represent of auth_user

2015-03-19 Thread Moiz Nagpurwala
Thanks for your reply. db.auth_user.id.represent = lambda row: row.first_name + row.last_name This is not working. -- 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

[web2py] Re: how to change the represent of auth_user

2015-03-19 Thread Moiz Nagpurwala
Field('foo', 'reference auth_user', requires=IS_IN_DB(db, 'auth_user.id', '%(first_name)s %(last_name)s')) This worked for me. Thanks a lot. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] how to change the represent of auth_user

2015-03-18 Thread Moiz Nagpurwala
Hello, I want to change the represent of auth_user in such a way that it does not show the id of user with her name. e.g. instead of displaying User name (1) I only want to display User name (without quotes). Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation)

[web2py] How to implement Gmail Authentication

2015-03-18 Thread Moiz Nagpurwala
Hello, I'm developing an application for internal use in my company (hosted locally). I want to enable authentication using Gmail e.g. my colleagues use there exiting gmail id for authentication. I have implemented this code provided in SMTP and Gmail found here

[web2py] Re: How to implement Gmail Authentication

2015-03-18 Thread Moiz Nagpurwala
I'm clueless here. I thought that this code would allow any user with valid gmail I'd to login in my app. -- 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) ---

[web2py] Re: Bootstrap is really killing web2py

2015-03-05 Thread Moiz Nagpurwala
Hello, I'm using latest relaease of web2py on my local machine. ( 2.9.12-stable+timestamp.2015.02.15.23.04.25 (Running on Rocket 1.2.6, Python 2.7.9)) Unable to install the w2p file provided for BS 3. Please help. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Error code: Unhandled Exception in PythonAnywhere hosting

2015-03-02 Thread Moiz Nagpurwala
In addition to my above question, it would be great help if someone could guide me to do a clean install of web2py 2.9.11 on pythonanywhere. I have only one application, which I would like to retain. I'm in touch with pythonanywhere support. I'll update here when I get any answer from them.

[web2py] Re: Error code: Unhandled Exception in PythonAnywhere hosting

2015-03-02 Thread Moiz Nagpurwala
With the kind help of support team from PythonAnywhere, I was able to resolve the problem. below is the summary of my correspondence with the support team: Did a clean install of web2py. I first moved the old web2py folder to a backup. In a Bash console, like so: mv ~/web2py ~/web2py.bak

[web2py] Error code: Unhandled Exception in PythonAnywhere hosting

2015-02-28 Thread Moiz Nagpurwala
Hello. I am hosting a personal app on Pythonanywhere which was working smoothly until i decided to update web2py. A couple of days ago, I tried to update to update web2py. It failed with an error stating __init__.py file is missing, but the app continued to work as usual. Tomorrow, for no

[web2py] Re: Reuse code in multiple views

2015-02-18 Thread Moiz Nagpurwala
Thanks Leonel for the reply. Putting the repeating code in a separate html file and including that file in appropriate places worked for me. Thanks a lot. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Reuse code in multiple views

2015-02-17 Thread Moiz Nagpurwala
I have this piece of code in my index view. I found myself repeating this code in other views. Following the DRY principal, what is the best way to make this code modular and easily reusable in any view. {{for entry in entries:}} div class=well {{=A(H4(entry.Entry_Date.strftime(%A, %d %B

[web2py] Re: Groupby year on date field

2015-02-17 Thread Moiz Nagpurwala
Thanks Niphlod. I worked for me. Here is the complete code. In my controller: sum_of_entries = db.mydiary.id.count() year_part = db.mydiary.Entry_Date.year() distinct_years = db(db.mydiary.id 0).select(sum_of_entries, year_part, groupby=db.mydiary.Entry_Date.year(), orderby=~sum_of_entries)

[web2py] Re: How to display the results of this query

2015-02-16 Thread Moiz Nagpurwala
Thanks a lot Massimo for your prompt and accurate answer. -- 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

[web2py] Re: Groupby year on date field

2015-02-16 Thread Moiz Nagpurwala
In my controller I have this code: sum_of_entries = db.mydiary.id.count() distinct_years = db(db.mydiary.id 0).select(sum_of_entries, db.mydiary. Entry_Date.year(), groupby=db.mydiary.Entry_Date.year(), orderby=~ sum_of_entries) In my view I'm trying to display the results in a loop like so:

[web2py] Re: Select records for current month

2015-02-15 Thread Moiz Nagpurwala
Thanks a lot Massimo. It worked for me. -- 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

[web2py] How to display the results of this query

2015-02-15 Thread Moiz Nagpurwala
How to display the results of this query in my controller i have this query: def location(): sum_of_entries = db.mydiary.id.count() distinct_loc = db(db.mydiary.id 0).select(sum_of_entries, db.mydiary. Location, groupby=db.mydiary.Location) # distinct_loc = db(db.mydiary.id

[web2py] Select record for yesterday

2015-02-14 Thread Moiz Nagpurwala
Hello all, In my model I have a date field like so: import datetime db.define_table('mydiary', Field('Entry_Date','date',default=datetime.datetime.now()), Field('Entry','text'), Field('Location','string',length=50) ) I want to

[web2py] Select records for current month

2015-02-14 Thread Moiz Nagpurwala
I want to select all records for current month. This is what i had tried so far. import datetime def index(): now = datetime.datetime.now() #entries = db().select(db.mydiary.ALL, orderby=~db.mydiary.Entry_Date) #the line below does not seem to work entries = db(db.mydiary.Entry_Date.month ==

[web2py] Re: Groupby year on date field

2015-02-05 Thread Moiz Nagpurwala
Yes sir, I'm sure. The sample database I had sent previously and my production database both have records in them. -- 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

[web2py] Re: Groupby year on date field

2015-02-03 Thread Moiz Nagpurwala
Hello, Sorry to bug you all, but I am still stuck with this year groupby issue. I am fairly new to Python and web2py. Any suggestions or alternative method to achieve the result is highly appreciated. Thank you all. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation)

[web2py] Re: Groupby year on date field

2015-02-02 Thread Moiz Nagpurwala
trangely, this is what I get with the same app, same data, same code, both on pythonanywhere and my local machine. https://lh3.googleusercontent.com/-mJM6wRc-lpc/VMxUS7cXeQI/A90/xFO6KgNk-DI/s1600/Capture.JPG On Saturday, January 31, 2015 at 3:14:22 AM UTC+5:30, Niphlod wrote:

[web2py] Re: Groupby year on date field

2015-01-29 Thread Moiz Nagpurwala
This is the controller: def year(): sum_of_entries = db.mydiary.id.count() years = db(db.mydiary.id 0).select(sum_of_entries, db.mydiary.Date. year(), groupby=db.mydiary.Date.year()) # years = db(db.mydiary.id 0).select(db.mydiary.Date.year(), distinct=True) return locals()

[web2py] Re: Groupby year on date field

2015-01-29 Thread Moiz Nagpurwala
Both of the approaches you suggested are not yielding any results. given that db.entries.date is a datetime field, the former is fetched with db(db.entries.id 0).select(db.entries.date.year(), distinct=True) while the latter, e.g. the entry count per year, with sum_of_entries =