Michael Ellis wrote:
>> What does the search funtion return?
>> A django queryset or a xapian result and are you sure that
>> the Paginator can handle the returned value?
>
> Hmmm. Great question.
>
> I believe it's returning a xapian result set.
>
> In my template, I'm looping through the paginator.object_list. Here's
> a simple example:
>
> {% for result in paginator.object_list %}
> {{ result.get_object.name }}
> {% endfor %}
here is your problem I'd guess.
I think you need to loop over the results.object_list since you are
doing this in your view:
results = paginator.page(pager)
.
.
.
return render_to_response(...., { 'results':results}
so the results templte variable is the page and only the page knows
what object are to be displayed on the page. The paginator only knows
all of the objects and the number of pages. The paginator object_list
can per definition only contain all the objects.
Hope that helped.
adi
>
> This gets me the name of the Product. Although I'm only indexing the
> Product.name and Product.description, I can get anything in the
> Product model by using {{ result.get_object.fieldname }}.
>
> If I replace {{ result.get_object.name }} with just {{ result }} in
> the above loop, here's an example of 2 returned results:
>
> <XapianHit: Model:Catalog.product pk:4, Score:96>
> <XapianHit: Model:Catalog.product pk:1, Score:62>
>
> ME
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---