(request)
return results
Searches recipes
Searches recipes
Searches recipes
def search(request):
    """
    Searches recipes
    """

    results = []

    # Search each model type by title, text, owner email/name.
    search_fields = ['name', 'text', 'owner__email', 'owner__profile__name']

    # Get the objects the user can access
    projects = get_project_list(user=request.user)

    recipes = Analysis.objects.filter(project__in=projects, root=None, deleted=False)
    # Load query from GET request.
    search_form = SearchForm(queryset=recipes, search_fields=search_fields,
                             data=request.GET or {})

    # Add search results to dict
    if search_form.is_valid():
        results = search_form.get_queryset()

    return results
def search ( request ) : results = [ ] # Search each model type by title, text, owner email/name. search_fields = [ 'name' , 'text' , 'owner__email' , 'owner__profile__name' ] # Get the objects the user can access projects = get_project_list ( user = request . user ) recipes = Analysis . objects . filter ( project__in = projects , root = None , deleted = False ) # Load query from GET request. search_form = SearchForm ( queryset = recipes , search_fields = search_fields , data = request . GET or { } ) # Add search results to dict if search_form . is_valid ( ) : results = search_form . get_queryset ( ) return results