Try queryset=Task.objects.filter(project=project) Regards,
On 11/25/09, Jamie Pittock <[email protected]> wrote: > I have two models, Project and Task. They are related via a foreign > key in the task model. > > The view that displays a task is below... > > def task_detail(request, project_slug, task_id): > project = get_object_or_404(Project, slug=project_slug) > return object_detail( > request, > queryset=Task.objects.all(), > object_id=task_id, > template_object_name="task", > extra_context = { 'project': project } > ) > > The URL would look like this... > > /projects/project_slug/tasks/task_id/ > > This is working as expected. However, the view is checking that the > project_slug is found, and also that the task_id is found, but it's > not checking that the found task is related to the found project. > > Could someone get me started on how best to write a view that would do > that? I'm presuming I'd have to part company with generic views for > this? > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > 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. > > > -- Sent from Gmail for mobile | mobile.google.com Rolando Espinoza La fuente qoSoftware www.qosoftware.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. 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.

