Thank you!
I've tested it, but when I try to insert a record to the db (on my
machine not on GAE), get the following error:
Traceback (most recent call last):
File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
restricted.py", line 188, in restricted
exec ccode in environment
File "/home/istvan/Documents/Mercurial/web2py-trunk-test/
applications/init/controllers/appadmin.py", line 410, in <module>
File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
globals.py", line 96, in <lambda>
self._caller = lambda f: f()
File "/home/istvan/Documents/Mercurial/web2py-trunk-test/
applications/init/controllers/appadmin.py", line 125, in insert
if form.accepts(request.vars, session):
File "/home/istvan/Documents/Mercurial/web2py-trunk-test/gluon/
sqlhtml.py", line 1103, in accepts
self.vars.id = self.table.insert(**fields)
TypeError: insert() keywords must be strings
Here is the relevant part of my db model:
db.define_table('gallery_images',
Field('img_upload', 'upload' ,uploadfield='img_blob'),
Field('img_blob', 'blob'))
db.define_table('gallery',
Field('category_id'),
Field('title'),
Field('title_hu'),
Field('thumbnail', 'upload',
uploadfield=db.gallery_images.img_upload),
Field('image', 'upload'),
Field('posted_on', 'datetime', default=request.now))
On Oct 1, 4:09 pm, mdipierro <[email protected]> wrote:
> I have not tested it yet so perhaps you can help me.
> In trunk
>
> db.define_table('imagestore',
> Field('name','upload',uploadfield='myblob'),
> Field('myblob','blob'))
>
> db.define_table('car'
> Field('name')
> Field('image','upload',uploadfield=db.imagestore.name))
>
> notice car.image points to imagestore.name and imagestore.name points
> to imagestore.myblob.
>
> form=crud.create(db.car)
>
> Should let you upload images but they all go into imagestore, not car.
> Everything else should work out of the box. I have not tried it.
> Please let me know what works or does not. Do not access imagestore
> directly.
>
> Massimo
>
> On Oct 1, 7:44 am, mdipierro <[email protected]> wrote:
>
>
>
>
>
>
>
> > It should be possible to re-write store() and retrieve() in sql.py to
> > do this. I will look into it.
>
> > Massimo
>
> > On Oct 1, 7:40 am, István Gazsi <[email protected]> wrote:
>
> > > Thanks for the quick reply! I have a database table which stores the
> > > title, the thumbnail, and the full size version of an image among
> > > other things. When I load 25 records from this table to a gallery, the
> > > GAE loads the whole records and it consumes a lot of IO.
>
> > > Can you recommend something about how can I store the full size image
> > > in another table while it's still connected to the thumbnail and other
> > > things? And I would like to upload the pictures via the default
> > > appadmin interface.