I've just uploaded a template filter called "several_random" to the
django snippets site. [0]

If you combine this with orestis's suggestion, I think you'll get what
you're looking for.

Quick side note:  Using the built-in random filter in a template
multiple times could give you the same result many times... so you
could end-up with the same feature three times on one page.

 - Ben

[0] http://www.djangosnippets.org/snippets/230/

On 5/11/07, Mordy Ovits <[EMAIL PROTECTED]> wrote:
>
> I have a sidebar in my page design.  I have 7 or so features that can
> go in a sidebar (links, quote of the day, infostat, on this day in
> history, etc.).  I have models for each of those features.
>
> I can easily use django to have the template fill those out for every
> page, but what I want is to choose 3 features of the seven at random.
> The point is to have 3 feaures in the sidebar of every page, but the
> specific three are chosen at random.
>
> I understand how to choose a random quote (using count and rand the
> slice of the queryset).  I can't figure out how to have the features
> themselves be random.  What's a sensible way to have n of m features,
> chosen at random, on the page?
>
> Thanks,
> Mordy
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to