views:

114

answers:

1

I want to do the following:

Having a model (p.e. a model which handles data about photographic reports) create a section which has a preview of an specific flickr album. The URL will be provided by an URLField (until the first save the preview will not be available).

After the first save, it'll show previews of all the images inside that album, and make them selectable (through jQuery for example). Then again, when the images are selected and the object is saved (I think I can use django signals for this) it will notify a specific user telling him a selection has been made.

Is there any plugins available, or any easy way to implement this in django-admin?

Update: 22 days and no anwers... does that mean it can't be done in django-admin?

+1  A: 

I personally can't think of any easy way to implement this in the Django admin, simply because I doubt many people who've done it have thought to open source it. I can imagine that it would be very specific to a certain user's / programmer's needs.

In any case, if you wanted to solve this issue, I'd say that your best bet would be overriding the Django admin templates in your django/contrib/admin/templates/admin folder. I believe you'd be best off by editing change_form.html.

My basic approach would be this:

  1. Check the name of the model using opts.verbose_name. For example, if you wanted to do this processing for a model whose verbose name is "Gallery", you would do

    {% ifequal opts.verbose_name "Gallery" %}
        <!-- neat gallery view -->
    {% else %}
        <!-- regular form -->
    {% endifequal %}
    
  2. Make a custom template tag that will display the gallery view / form given the object_id and the type of object. This way you can replace the <!-- neat gallery view --> with a {% show_gallery object_id %}. See the Django Docs for more info on creating custom template tags. It's pretty straightforward.

  3. Add whatever Javascript or custom stuff in your template tag template. What you choose to do is up to you.

Sorry you haven't gotten many more answers to your question. Hope this helps!

Dan Loewenherz
You're right, this is probably a very specific issue. It's a good idea to modify the admin templates but I was looking for something "ready-to-use" like django-syncr or FlickrIntegration.
Oscar Carballal
Since no one else answered the bounty goes for you. I'll try to modify the admin templates. Thanks :)
Oscar Carballal
No problem at all!
Dan Loewenherz