django-picasa icondjango-picasa 1.2

A module of Django components that give you Picasa storage, Picasa fileds and admin fields
djgoogle.picasa is Django app that gives you Picasa storage, picasa fileds and admin fields.

1. List this application in the **INSTALLED_APPS** portion of your settings
file.  Your settings file might look something like::
# ...

2. Then add to the file your PICASA_STORAGE_OPTIONS::
'cache': True}

email is your Picasa account id.
source is a string you will use to identify how the images where added to your Picasa account.
user is the actual Picassa account that the images will stored in. It doesn't have to be your account just any account you have the access to.
cache is weather you want to use Django's caching back-end. Usually it's worth it.
I'll revisit the other options of PICASA_STORAGE_OPTIONS later.

4. if you have set cache to true they you might want to add something like this::
CACHE_BACKEND = "locmem://?timeout=30&max_entries=400"

5. Now you are done with the file you can replace the ImageFields? with the picasa field in your models::

from picasa import  PicasaField

class Image(models.Model):
photo = PicasaField( )

6. Try it out by uploading an image through your admin page and then visit your Picasa account. You will see the uploaded image in your Drop Box.

7. Added a upload_to='media' and it will upload the file into an album called media, if the album doesn't exist it will be created.::

photo = PicasaField( upload_to='media')


1. The default admin representaion of your image will be handled by the AdminFileWidget which will just show the value of PicasaField.url of the containing web page in your Picasa account. It's useful but would be better to see a linked thumbnail. To do that you need to override the PicasaField with PicasaAdminImageWidget. To do that import the widget in your module and add it to an formfield_overrides dictionary:
from picasa import  PicasaAdminImageWidget
class ImageAdmin(admin.ModelAdmin)::
formfield_overrides = {PicasaField: {'widget': PicasaAdminImageWidget},} ImageAdmin)

2. By default PicasaAdminImageWidget? generates a 64 pixel icon. The sizes available are:
32      48      64      72      104     144     150     160     94      110     128     200     220     288     320     400     512     576     640     720     800     912     1024    1152    1280    1440    1600

3. You can override the class attribute SIZE to change the thumbnail's size:
class ImageWidget(PicasaAdminImageWidget)::

class ImageAdmin(admin.ModelAdmin):
formfield_overrides = {PicasaField: {'widget': ImageWidget},}

Possible Problems:

if you are behind a proxy and you get the following error when you try an upload an image::
gaierror at /admin/cms/image/add/
(11001, 'getaddrinfo failed')

Check that you have set both HTTP_PROXY and HTTPS_PROXY. HTTPS_PROXY can usually be set to the same host as HTTP_PROXY.

last updated on:
February 12th, 2010, 1:14 GMT
developed by:
Thanos Vassilakis
license type:
LGPL (GNU Lesser General Public License) 
ROOT \ Internet \ HTTP (WWW)


In a hurry? Add it to your Download Basket!

user rating 1



Add your review! 1 USER REVIEW SO FAR