I am building an app where user can upload pictures to their profile, i want that every user can see their own pictures
I tried getting photos from database and then displaying them in repeating panel
Code Sample:
server code:
def getposts():
user = anvil.users.get_user()
if user:
return app_tables.posts.client_writable(User=user)
client code:
user_pictures = anvil.server.call('getposts')
self.repeating_panel_1.items = user_pictures.search()
Clone link:
Welcome to the forum!
That’s a link to the live app, not a clone link. You might need to scroll down a bit in the screen with the clone link to get to the actual clone link. It’s not as obvious as it should be the first time.
Anyway, to get the pictures to show up in the repeating panel, you’re going to need to put an image component in the repeating panel row template, and bind the source
attribute of the image component to the item in the row that is the picture.
The news aggregator tutorial shows doing this: Anvil | Build Database-Backed Apps
1 Like
This shows how to display images from the database in a repeating panel, and also in a flow panel (plus how to search for specific images in the DB):
https://anvil.works/build#clone:W2Y3ZDQYKDQL6UY6=UHKAHI6NDE5RECBOIGXNXZJC