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)
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'})
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'})
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)
def search(request): return basic_search(request, extra_context={ 'nav': Page.objects.all(), 'map': Map.objects.get(title="Tower Hamlets"), 'layers': Layer.objects.all(), })
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 )
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}, )
def custom_search_view(request, *args, **kwargs): return basic_search(request, *args, **kwargs)
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)