[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Maposmatic-dev] [PATCH] Add pagination when searching
From: |
David MENTRE |
Subject: |
Re: [Maposmatic-dev] [PATCH] Add pagination when searching |
Date: |
Mon, 21 Jun 2010 11:51:58 +0200 |
Hello Maxime²,
2010/6/21 Maxime Hadjinlian <address@hidden>:
> --- a/www/maposmatic/views.py
> +++ b/www/maposmatic/views.py
> @@ -141,21 +141,16 @@ def all_maps(request):
> terms, when provided."""
>
> map_list = None
> -
> - if request.method == 'POST':
> - form = forms.MapSearchForm(request.POST)
> - if form.is_valid():
> - map_list = (models.MapRenderingJob.objects
> - .order_by('maptitle')
> - .filter(status=2)
> -
> .filter(maptitle__icontains=form.cleaned_data['query']))
> - if len(map_list) == 1:
> - return HttpResponseRedirect(reverse('job-by-id',
> - args=[map_list[0].id]))
> -
> - # TODO: find a way to have a working paginator. For now, limit to
> - # ITEMS_PER_PAGE results.
> - map_list = map_list[:www.settings.ITEMS_PER_PAGE]
> + form = forms.MapSearchForm(request.GET)
> +
> + if form.is_valid():
> + map_list = (models.MapRenderingJob.objects
> + .order_by('maptitle')
> + .filter(status=2)
> + .filter(maptitle__icontains=form.cleaned_data['query']))
> + if len(map_list) == 1:
> + return HttpResponseRedirect(reverse('job-by-id',
> + args=[map_list[0].id]))
On this patch you do not test "if request.method == 'GET':". Can I
assume this code is not necessary?
Best regards,
david