On Wednesday, October 15, 2014 11:27:35 PM UTC-7, Joe wrote:
>
>  This is  what I am trying to do: I want the user to be able to select 
> images, using a select button under each image. 
>
> My plan to achieve this is:
>
> 1. define a table for all the images and define an other table for the 
> images the user will select.
> 2. create a function with an SQLFORM to process this somehow so I will 
> have a list of the selected images in the database
>
>
SQLFORM would be a tool to help you present images to the user and to get 
his responses (which ones he was selecting).  (You might be presenting a 
set of thumbnails for the user to select which [full-size] images to do 
some image processing on, for instance.)

My thoughts are that you would then do one of 3 things with the response, 
depending on what worked for the next [image processing] step:

1) store the selections as a list in the session
2) store the selections by setting a field in your table that tracks the 
images
3) store the selections as a "transaction table" that is just a small table 
that mainly is a ref to the main table.

1 and 3 are similar in approach, but implemented differently.  1 would be 
more suitable if you were immediately going on to begin processing the 
selections,
and 3 would be helpful if the user was expecting to browse all the way 
through the collection of images before beginning processing.

2 would work either way.  In this case, you'd have just one table, the main 
list:

db.define_table('images',
  Field('thumb', ....), 
  Field('image', ...),
  Field('selected', boolean),
  Field('other_property, ...), 
 ....)

I'd go on to say that which one works best depends on what the user is 
trying to do with the images, so we would probably want more context before 
choosing.

If you're just doing this a practice project, any of the 3 would be 
appropriate, and I don't see much difference in difficulty to implement.  I 
am, however, saying that as someone who sometimes does web2py stuff to make 
tools for my real job, and not as a guru.

Good luck!

/dps



 

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

Reply via email to