Hi Dave,

Thanks so much for your help! I have been working on this and didn't get 
too far. I am trying to understand the syntax and the logic so I can learn 
how to do this and then apply it in an application I am working on just for 
my self of course.

Here is where I am at the moment: I tried the Field('image' 'upload') but I 
couldn't figure out how to handle the uploaded img file in the db after it 
was uploaded. I was able to display the image but then I couldn't do much 
more. I just don't have the knowledge. 

Now I am trying to have the user select the image name instead of the 
image, so I don't have to upload the images in the database, I can upload 
the images in the static folder instead. This way I can have a list of 
names for selected images and later I have to find a way the match the 
names with the images then I will have what I need.

Now I am trying to do this:

    db.define_table('images',
      Field('picture_name'))
  

    db.define_table('chosen',
      Field('selected_pictures', 'boolean'))

I am trying have one db for the picture's name and one for the selected 
picture names. It would be a big step forward (I think) if I can select the 
picture_name from the images db and the picture_name would somehow end up 
in the in the chosen db. Of course, I don't know how to do this and I don't 
know if this is the best way to approach this.

This is where I am stuck:

    def index():
        form = SQLFORM(db.images).process()
        return dict(form=form)

    def pictures():
        form = SQLFORM(db.chosen).process()
        return dict(form=form)

I'd appreciate any help, thanks again.


On Saturday, October 18, 2014 2:01:44 AM UTC+8, Dave S wrote:
>
>
> 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