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:
-
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
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
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
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
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)
-
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)
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
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)
---
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)
-
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.
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
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
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)
-
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
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)
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
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:
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
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
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
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 ==
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
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)
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:
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()
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 =
27 matches
Mail list logo