Hello there, I am new to web2py and learning by making a simple Social
Network app, I got started with the image blog app found on github/appliances
(https://github.com/mdipierro/web2py-appliances). First I added this table:
auth.settings.extra_fields['auth_user']= [
Field('profile_picture','upload',required=True, notnull=True, requires=[
IS_IMAGE(), RESIZE(650, 650)]),
Field('profile_thumbs','upload',readable=False, compute=lambda r: THUMB(r[
'profile_picture']))
]
in order to modify the auth_user table and add the profile_thumbs field, so
the photo uploaded on profile_picture gets resized and posted on database.
on the controller I am using this code:
def profile():
tables = db().select(db.auth_user.ALL)
return dict(tables=tables)
and for the view:
{{for table in tables:}}
<img src="{{=URL('default', 'download', args=table.profile_picture)}}"
/> <br />
{{pass}}
All the pictures on the db are displayed I would like to only have the
picture for the user logged in.
I would like to ask if anybody could help or point me to the right
direction to a tutorial where I can make a profile page to each user
displaying their information such as first_name, last_name and
profile_picture to begin with but sure I will need to expand that in later
date. How could be the right procedure to do this? Should I use the
auth_user data to have this page?
Thank you very much, I think this problem might have been asked before but
hope someone can help anyway :)
Regards
Ricardo Bento
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.