def show_adv_search_filter(context): search_form = job_searchForm() return { "request": context["request"], "search_form": search_form, "job_types": JOB_TYPE, "walkin_types": WALKIN_TYPE, }
def show_adv_search_filter(context): search_form = job_searchForm() return { 'request': context['request'], 'search_form': search_form, 'job_types': JOB_TYPE, 'walkin_types': WALKIN_TYPE }
def show_search_filter(context): search_form = job_searchForm() return { "request": context["request"], "search_form": search_form, "job_types": JOB_TYPE, "searched_skills": context.get("searched_skills"), "searched_edu": context.get("searched_edu"), "searched_locations": context.get("searched_locations"), "searched_states": context.get("searched_states"), "searched_experience": context.get("searched_experience"), "searched_job_type": context.get("searched_job_type"), "searched_text": context.get("searched_text"), }
def show_search_filter(context): search_form = job_searchForm() return { 'request': context['request'], 'search_form': search_form, 'job_types': JOB_TYPE, 'searched_skills': context.get('searched_skills'), 'searched_edu': context.get('searched_edu'), 'searched_locations': context.get('searched_locations'), 'searched_states': context.get('searched_states'), 'searched_experience': context.get('searched_experience'), 'searched_job_type': context.get('searched_job_type'), 'searched_text': context.get('searched_text'), }
def show_mobile_search_filter(context): search_form = job_searchForm() return { "request": context["request"], "search_form": search_form, "job_types": JOB_TYPE, "searched_skills": context.get("searched_skills"), "searched_locations": context.get("searched_locations"), "searched_job_type": context.get("searched_job_type"), "searched_edu": context.get("searched_edu"), "searched_industry": context.get("searched_industry"), "searched_experience": context.get("searched_experience"), "searched_states": context.get("searched_states"), "searched_functional_area": context.get("searched_functional_area"), # 'search_slug': context.get('search_slug') }
def show_mobile_search_filter(context): search_form = job_searchForm() return { 'request': context['request'], 'search_form': search_form, 'job_types': JOB_TYPE, 'searched_skills': context.get('searched_skills'), 'searched_locations': context.get('searched_locations'), 'searched_job_type': context.get('searched_job_type'), 'searched_edu': context.get('searched_edu'), 'searched_industry': context.get('searched_industry'), 'searched_experience': context.get('searched_experience'), 'searched_states': context.get('searched_states'), 'searched_functional_area': context.get('searched_functional_area'), # 'search_slug': context.get('search_slug') }
def custom_search(data, request): form = job_searchForm(data) searched_locations = searched_skills = searched_edu = searched_industry = searched_states = '' if request.POST.get('refine_search') == 'True': jobs_list, searched_skills, searched_locations, searched_industry, searched_edu, searched_states = refined_search( request.POST) else: jobs_list = form.search() jobs_list = JobPost.objects.filter(pk__in=[r.pk for r in jobs_list]) searched_locations = City.objects.filter(name__in=data.get('location')) searched_skills = Skill.objects.filter(name__in=data.get('q')) jobs_list = jobs_list.filter(status="Live") job_type = data.get('job_type') or request.POST.get( 'job_type') or request.GET.get('job_type') if job_type: jobs_list = jobs_list.filter(job_type=job_type) if data.get('walk-in'): jobs_list = jobs_list.filter(job_type="walk-in") no_of_jobs = len(jobs_list) items_per_page = 20 no_pages = int(math.ceil(float(jobs_list.count()) / items_per_page)) page = request.POST.get('page') or data.get('page') if page and bool(re.search(r"[0-9]", page)) and int(page) > 0: if int(page) > (no_pages + 2): page = 1 else: page = int(data.get('page')) else: page = 1 jobs_list = jobs_list.select_related('company', 'user').prefetch_related( 'location', 'skills', 'industry').distinct() jobs_list = jobs_list[(page - 1) * items_per_page:page * items_per_page] prev_page, previous_page, aft_page, after_page = get_prev_after_pages_count( page, no_pages) if form.is_valid(): context = { 'results': form.search(), 'query': form.query(), 'searchform': form, 'aft_page': aft_page, 'after_page': after_page, 'prev_page': prev_page, 'previous_page': previous_page, 'current_page': page, 'last_page': no_pages, 'no_of_jobs': no_of_jobs, 'job_list': jobs_list, 'skill': form.cleaned_data['q'], 'location': form.cleaned_data['location'], 'searched_skills': searched_skills, 'searched_locations': searched_locations, 'searched_industry': searched_industry, 'searched_edu': searched_edu, 'searched_experience': request.POST.get('experience'), 'searched_job_type': request.POST.get('job_type'), 'searched_functional_area': request.POST.get('functional_area'), } return context return {'job_list': []}
def custom_search(data, request): form = job_searchForm(data) searched_locations = ( searched_skills ) = searched_edu = searched_industry = searched_states = "" if request.POST.get("refine_search") == "True": ( jobs_list, searched_skills, searched_locations, searched_industry, searched_edu, searched_states, ) = refined_search(request.POST) else: jobs_list = form.search() jobs_list = JobPost.objects.filter(pk__in=[r.pk for r in jobs_list]) searched_locations = City.objects.filter(name__in=data.get("location")) searched_skills = Skill.objects.filter(name__in=data.get("q")) jobs_list = jobs_list.filter(status="Live") job_type = (data.get("job_type") or request.POST.get("job_type") or request.GET.get("job_type")) if job_type: jobs_list = jobs_list.filter(job_type=job_type) if data.get("walk-in"): jobs_list = jobs_list.filter(job_type="walk-in") no_of_jobs = len(jobs_list) items_per_page = 20 no_pages = int(math.ceil(float(jobs_list.count()) / items_per_page)) page = request.POST.get("page") or data.get("page") if page and bool(re.search(r"[0-9]", page)) and int(page) > 0: if int(page) > (no_pages + 2): page = 1 else: page = int(data.get("page")) else: page = 1 jobs_list = (jobs_list.select_related("company", "user").prefetch_related( "location", "skills", "industry").distinct()) jobs_list = jobs_list[(page - 1) * items_per_page:page * items_per_page] prev_page, previous_page, aft_page, after_page = get_prev_after_pages_count( page, no_pages) if form.is_valid(): context = { "results": form.search(), "query": form.query(), "searchform": form, "aft_page": aft_page, "after_page": after_page, "prev_page": prev_page, "previous_page": previous_page, "current_page": page, "last_page": no_pages, "no_of_jobs": no_of_jobs, "job_list": jobs_list, "skill": form.cleaned_data["q"], "location": form.cleaned_data["location"], "searched_skills": searched_skills, "searched_locations": searched_locations, "searched_industry": searched_industry, "searched_edu": searched_edu, "searched_experience": request.POST.get("experience"), "searched_job_type": request.POST.get("job_type"), "searched_functional_area": request.POST.get("functional_area"), } return context return {"job_list": []}