[yocto] [layerindex-web][PATCH 1/2] views.py: Redirect to recipe details for single results
Paul Eggleton
paul.eggleton at linux.intel.com
Mon Mar 13 19:22:54 PDT 2017
This should be using a reverse() call instead of a hardcoded URL path suffix.
However, since that was a trivial fix I've done that and merged it - it'll
appear in the layer index once we do the next upgrade (fairly soon).
Cheers,
Paul
On Tuesday, 14 March 2017 9:35:16 AM NZDT Jose Lamego wrote:
> Ping.
>
> On 01/18/2017 04:19 PM, Jose Lamego wrote:
> > From: Alex Franco <alejandro.franco at 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 at 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', '')
--
Paul Eggleton
Intel Open Source Technology Centre
More information about the yocto
mailing list