示例#1
0
def place_search(request):
    """ A view to search in a specific place """
    entity_slug = request.GET.get('entity_slug', None)
    if entity_slug:
        searchqs = SearchQuerySet().filter(place=Exact(entity_slug))
        return basic_search(request, searchqueryset=searchqs)
    return basic_search(request)
示例#2
0
def place_search(request):
    """ A view to search in a specific place """
    entity_slug = request.GET.get('entity_slug', None)
    if entity_slug:
        searchqs = SearchQuerySet().filter(place=Exact(entity_slug))
        return basic_search(request, searchqueryset=searchqs)
    return basic_search(request)
示例#3
0
文件: views.py 项目: Bobby1994/okqa
def place_search(request):
    """ A view to search in a specific place """
    place = request.GET.get('place')
    if place:
        searchqs = SearchQuerySet().filter(place=Exact(place))
        context = {'entity': get_object_or_404(Entity, slug=place),
                   'base_template': 'place_base.html',
        }
        return basic_search(request, searchqueryset=searchqs,
                            extra_context=context)
    return basic_search(request, extra_context={'base_template': 'base.html'})
示例#4
0
文件: views.py 项目: amirnissim/okqa
def place_search(request):
    """ A view to search in a specific place """
    place = request.GET.get('place')
    if place:
        searchqs = SearchQuerySet().filter(place=Exact(place))
        context = {
            'entity': get_object_or_404(Entity, slug=place),
            'base_template': 'place_base.html',
        }
        return basic_search(request,
                            searchqueryset=searchqs,
                            extra_context=context)
    return basic_search(request, extra_context={'base_template': 'base.html'})
示例#5
0
def place_search(request, entity_slug=None):
    """ A view to search in a specific place """
    if entity_slug:
        searchqs = SearchQuerySet().filter(place=Exact(entity_slug))
    else:
        searchqs = SearchQuerySet().exclude(place=Exact(u"אא-מעלה-אבק"))
    return basic_search(request, searchqueryset=searchqs)
示例#6
0
def place_search(request, entity_slug=None):
    """ A view to search in a specific place """
    if entity_slug:
        searchqs = SearchQuerySet().filter(place=Exact(entity_slug))
    else:
        searchqs = SearchQuerySet().exclude(place=Exact(u"אא-מעלה-אבק"))
    return basic_search(request, searchqueryset=searchqs)
示例#7
0
def search(request):
		
	return basic_search(request, extra_context={
		'nav': Page.objects.all(),
		'map': Map.objects.get(title="Tower Hamlets"),
		'layers': Layer.objects.all(),
		})
示例#8
0
文件: __init__.py 项目: snswa/swsites
def haystack_search(request, template="search/search.html", extra_context=None, *args, **kwargs):
    extra_context = extra_context or {}
    # Filter out private teams that the user is not a member of.
    exclude_teams = [-1] + [
        team.id
        for team in Team.objects.filter(is_private=True)
        if not team.user_is_member(request.user)
    ]
    searchqueryset = SearchQuerySet().exclude(team_id__in=exclude_teams)
    return basic_search(
        request,
        template=template,
        form_class=TeamSearchForm,
        searchqueryset=searchqueryset,
        extra_context=extra_context,
        *args, **kwargs
    )
示例#9
0
        type = request.POST["type"]
        bookmark_id = request.POST["id"]
        if type == "trip":
            trip = Trip.objects.get(id=bookmark_id)
            trip.ideas.add(post)
            trip.save()
        elif type == "city":
            city = VisitedCity.objects.get(id=bookmark_id)
            city.ideas.add(post)
            city.save()
        else:
            day = VisitedDay.objects.get(id=bookmark_id)
            day.ideas.add(post)
            day.save()
        return HttpResponse(simplejson.dumps())
    if user.is_authenticated():
        current_trip = Trip.objects.get(id=id)
        trips = Trip.objects.filter(user=user)
        cities = VisitedCity.objects.filter(trip=current_trip)
        days = {}
        # populates days for use in sidebar
        for city in cities:
            ds = VisitedDay.objects.filter(visited_city=city)
            days[city] = ds

    return basic_search(
        request,
        template="tripplanning.html",
        extra_context={"trips": trips, "id": id, "current_trip": current_trip, "days": days},
    )
示例#10
0
def custom_search_view(request, *args, **kwargs):
    return basic_search(request, *args, **kwargs)
示例#11
0
文件: views.py 项目: albanm/djity
def project_search(request,context=None):
    """
    Override haystack basic_view for customization.
    """
    sqs = SearchQuerySet().narrow("project:%s"% context['project'].id).narrow("status:%s" % settings.LOWER_VISIBLE_STATUS[context['role']])
    return basic_search(request, template='djity/search/search.html', searchqueryset=sqs, form_class=SearchForm, extra_context=context, context_class=DjityContext)