This sounds like a good fit for an inclusion tag. Since you need a bit of
markup around the images for the slider functionality, it'd be nice to keep
that markup in a separate template so you could use the image slider in
multiple places like, say, a post detail page as well as a dashboard. Then,
anytime you wanted to create image slider, in your template you could
simply do something like:

{% load image_extras %}

...
{% image_slider post.image_set %}
...

Docs:
https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags

JDB


On Mon, Feb 24, 2014 at 11:39 PM, Dennis Marwood <dennismarw...@gmail.com>wrote:

> Hi. I am looking for some advice on the best way to approach the
> following:
>
> I am pulling my blog posts out of my db. Inside of the posts I want to use
> an image scroller ( http://cssdeck.com/labs/css3-image-slider ), but I
> don't want to write all of the boilerplate surrounding each image every
> time.
>
> The idea I have is a template filter.... but that just seems wrong. What's
> the proper way to handle this?
>
> Ideally, I would just add some bit in my post like css_slider({loc:
> loc_pic_1, desc: "blah blah"}, {loc: loc_pic_1, desc: "blah"}...)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d38e2a00-5ae9-4e8e-8333-0677cc206a5e%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPMFOb6iPJvUWGeLWkogmx5Bj4X22aNz8bN6pHSKqXm7hN-gyw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to