tags:

views:

75

answers:

1
Model.objects.filter(pk__in=[list of ids])

and

Model.objects.filter(pk__in=[1,2,3])

How do I show this data in a template?

def xx(request):
    return HttpResponse(Model.objects.filter(pk__in=[1,2,3]))
+10  A: 

It means, give me all objects of model Model that either have 1,2 or 3 as their primary key.

See Field lookups - in.

You get a list of objects back you can show them in the template like every other list, using the for template tag:

{% for object in objects %}
    Some value: {{ object.value }}
{% endfor %}

I don't want to offend you, but what is your problem? This is all well described in the documentation.

To learn how to create a Django application you should read the tutorial or the Django book.

Felix Kling