[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:
- 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/dc2d5852-d06f-403a-af16-fc3eb9de8a9cn%40googlegroups.com.


[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 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 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 (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.


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 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.


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 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 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)
- 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 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)
- 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 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 
http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms
in my db.py

from gluon.contrib.login_methods.email_auth import *
auth.settings.login_methods.append(email_auth(smtp.gmail.com:587,@gmail.com))


Nothing seem to happen.

Please 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: 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)
--- 
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: 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)
- 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: 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.

Thanks and regards.

-- 
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: 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

Then, from the web tab, deleted my web app, and then re-created a new 
web2py app.
Then did a copy-paste of all my files from my backup.

Important: At first I got Error 1050, Table 'auth_user' already exists
Which was solved by adding db = DAL(...,fake_migrate_all=True)

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] 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 particular reason I clicked the green button in 
PythonAnywhere console which says: Reload ###.pythonanywhere.com.
The app immediately stopped working and the error log showed these errors:

2015-02-28 04:45:01,615 :ImportError: No module named base
2015-02-28 04:45:02,000 :Traceback (most recent call last):
2015-02-28 04:45:02,000 :  File /bin/user_wsgi_wrapper.py, line 130, in 
__call__
2015-02-28 04:45:02,000 :self.error_log_file.logger.exception(Error 
running WSGI application)
2015-02-28 04:45:02,000 :  File /usr/lib/python2.7/logging/__init__.py, 
line 1185, in exception
2015-02-28 04:45:02,001 :self.error(msg, *args, **kwargs)
2015-02-28 04:45:02,001 :  File /usr/lib/python2.7/logging/__init__.py, 
line 1178, in error
2015-02-28 04:45:02,001 :self._log(ERROR, msg, args, **kwargs)
2015-02-28 04:45:02,001 :  File /usr/lib/python2.7/logging/__init__.py, 
line 1270, in _log
2015-02-28 04:45:02,001 :record = self.makeRecord(self.name, level, fn, 
lno, msg, args, exc_info, func, extra)
2015-02-28 04:45:02,001 :  File /usr/lib/python2.7/logging/__init__.py, 
line 1244, in makeRecord
2015-02-28 04:45:02,002 :rv = LogRecord(name, level, fn, lno, msg, 
args, exc_info, func)
2015-02-28 04:45:02,002 :  File /usr/lib/python2.7/logging/__init__.py, 
line 284, in __init__
2015-02-28 04:45:02,002 :self.threadName = 
threading.current_thread().name
2015-02-28 04:45:02,002 :  File /usr/lib/python2.7/threading.py, line 
1160, in currentThread
2015-02-28 04:45:02,002 :return _active[_get_ident()]
2015-02-28 04:45:02,002 :  File /bin/user_wsgi_wrapper.py, line 122, in 
__call__
2015-02-28 04:45:02,002 :app_iterator = self.app(environ, 
start_response)
2015-02-28 04:45:02,002 :  File /bin/user_wsgi_wrapper.py, line 136, in 
import_error_application
2015-02-28 04:45:02,003 :raise e

/bin/user_wsgi_wrapper.py
/usr/lib/python2.7/logging/__init__.py
/usr/lib/python2.7/threading.py

This is surely related to the failed update.
Not sure which of these files are the culprits?

Please help.

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: 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)
- 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] 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 %Y)), _href=URL(edit_entry
,args=entry.id))}}
  {{=DIV(B(entry.Location),_class=pull-right)}}
  {{=MARKMIN(entry.Entry)}}
 /div
{{pass}}

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: 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)

In my view:
ul class=list-group
{{for y in distinct_years:}}
{{yr=y[year_part]}}
{{count=y[sum_of_entries]}}
li class=list-group-item{{=A(yr, _href=URL(year,args=yr))}}span class
=badge pull-right{{=count}}/span/li
{{pass}}
/ul

-- 
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 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 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: 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:
ul class=list-group
 {{for y in distinct_years:}}
 {{yr=y}}  #cant extract the year part into yr variable
 {{count=y[sum_of_entries]}}  #this extracts the count in a variable 
successfully
 li class=list-group-item{{=A(yr, _href=URL(year,args=yr))}}span 
class=badge pull-right{{=count}}/span/li
 {{pass}}
/ul

when I print the y it outputs this result:
Row {'_extra': {'COUNT(mydiary.id)': 1L, 'EXTRACT(year FROM 
mydiary.Entry_Date)': 2001L}}

Please guide me to extract the year part from this Row object.
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: 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 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 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  0).select(db.mydiary.Location, 
distinct=True)
return locals()

I want to display each record in below format:

ul
li class=list-group-item*Location*span class=badge pull-right
*Count*/span/li
/ul


Please 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] 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 select record for tomorrow and check if any rows are returned.

Please 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] 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 == now.month).select(db.mydiary.
ALL,orderby=~db.mydiary.Entry_Date)
 return locals()


Please help.

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: 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 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: 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)
- 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: 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:


 https://lh6.googleusercontent.com/-pWsAPTKJbZ8/VMv7E7GHWnI/ARs/OMWXe-Ku54c/s1600/counts.png
 are you sure that the issue is not fetching but rather visualizing the 
 results you already fetched ???


-- 
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: 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()

This is the view:
div class=well
{{=sum_of_entries}}
{{=years}}
/div

It only outputs:
COUNT(mydiary.id)

Please 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: 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 = db.entries.id.count()
 db(db.entries.id  0).select(sum_of_entries, db.entries.date.year(), 
 groupby=db.entries.date.year())


I tried assigning the results of the query to a variable and display it in 
a view, which does not work.

In Controller:
def year():
years = db(db.mydiary.id  0).select(db.mydiary.Date.year(), distinct=
True)

return locals() 


In View:
div class=well
{{=BEAUTIFY(years)}}
{{=years}} 
/div

the variable is printed twice purposely.

-- 
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.