Am I right that you have a one-to-many relationship between events and
questions, with questions having a foreign key to events?
Then you could add a method to your Event model class that returns you a
random list of questions:

class Event (model.Models):
...
    def questions(self):
        questions = self.question_set.all().order_by('?')
        return questions
....

You can then call the questions method inside your template when you have an
event:

{% for question in event.questions %}
question....
{% endfor %}

Ludwig


2008/9/3 Cortland Klein <[EMAIL PROTECTED]>

>
> Yes, but I don't want to randomize he Events, but the Questions that
> belong to the events.
>
> On Sep 3, 2008, at 12:07 PM, Ludwig wrote:
>
> > There is nothing to stop you putting the order_by clause into a
> > generic view, like so:
> >
> > event_info = {
> >     'queryset' : Events.objects.order_by('?'),
> > }
> >
>
> --
> Cortland Klein <[EMAIL PROTECTED]> +1 408 506 9791
> http://pixelcort.com/
> 2260 California Street #13
> Mountain View, CA, USA 94040
>
> Alumni, Business Management <[EMAIL PROTECTED]>
> San José State University
>
> Alumni Technical Advisor, Entrepreneurial Society <[EMAIL PROTECTED]
>  >
> http://e-society.org/
>
> Q&A Techie, Silicon Valley Mac User Group
> http://svmug.org/
>
> Member, Silicon Valley Google Technology User Group
> http://sv-gtug.org/
>
>
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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