All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jose Lamego <jose.a.lamego@linux.intel.com>
To: yocto@yoctoproject.org
Cc: "paul.eggleton@linux.intel.com" <paul.eggleton@linux.intel.com>,
	Alex Franco <alejandro.franco@linux.intel.com>
Subject: Re: [layerindex-web][PATCH 1/2] views.py: Redirect to recipe details for single results
Date: Mon, 13 Mar 2017 14:35:16 -0600	[thread overview]
Message-ID: <02120cfb-c133-2b1d-54b6-5054cd047a19@linux.intel.com> (raw)
In-Reply-To: <1484777982-7168-2-git-send-email-jose.a.lamego@linux.intel.com>


[-- Attachment #1.1: Type: text/plain, Size: 1443 bytes --]

Ping.

On 01/18/2017 04:19 PM, Jose Lamego wrote:
> From: Alex Franco <alejandro.franco@linux.intel.com>
> 
> When a recipe search returns only one result, clicking the single
> result at the results view is still required to view further
> recipe detail.
> 
> This change automatically redirects to the recipe details view
> when the recipe search returns a single result.
> 
> [YOCTO #6618]
> 
> Signed-off-by: Jose Lamego <jose.a.lamego@linux.intel.com>
> ---
>  layerindex/views.py | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/layerindex/views.py b/layerindex/views.py
> index 0f73e93..03fadbb 100644
> --- a/layerindex/views.py
> +++ b/layerindex/views.py
> @@ -372,6 +372,14 @@ class RecipeSearchView(ListView):
>      context_object_name = 'recipe_list'
>      paginate_by = 50
>  
> +    def render_to_response(self, context, **kwargs):
> +        if len(self.object_list) == 1:
> +            return HttpResponseRedirect("/layerindex/recipe/%s/"
> +                                        % self.object_list[0].id)
> +        else:
> +            return super(ListView, self).render_to_response(context,
> +                                                            **kwargs)
> +
>      def get_queryset(self):
>          _check_url_branch(self.kwargs)
>          query_string = self.request.GET.get('q', '')
> 

-- 
Jose Lamego | OTC Embedded Platforms & Tools | GDC


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 484 bytes --]

       reply	other threads:[~2017-03-13 20:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1484777982-7168-1-git-send-email-jose.a.lamego@linux.intel.com>
     [not found] ` <1484777982-7168-2-git-send-email-jose.a.lamego@linux.intel.com>
2017-03-13 20:35   ` Jose Lamego [this message]
2017-03-14  2:22     ` [layerindex-web][PATCH 1/2] views.py: Redirect to recipe details for single results Paul Eggleton
     [not found] ` <1484777982-7168-3-git-send-email-jose.a.lamego@linux.intel.com>
2017-03-13 20:35   ` [layerindex-web][PATCH 2/2] views.py: Consider layer name in recipe search Jose Lamego
2017-03-14  2:01     ` Paul Eggleton
2017-04-03 19:41       ` Jose Lamego
2017-01-18 22:31 [layerindex-web][PATCH 0/2] Improvements to " Jose Lamego
2017-01-18 22:31 ` [layerindex-web][PATCH 1/2] views.py: Redirect to recipe details for single results Jose Lamego
2017-01-24 18:47   ` Jose Lamego

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=02120cfb-c133-2b1d-54b6-5054cd047a19@linux.intel.com \
    --to=jose.a.lamego@linux.intel.com \
    --cc=alejandro.franco@linux.intel.com \
    --cc=paul.eggleton@linux.intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.