예제 #1
0
def search(request):
    organizations_list = []
    if request.method == 'POST':
        form = SearchVolunteerForm(request.POST)
        if form.is_valid():

            first_name = form.cleaned_data['first_name']
            last_name = form.cleaned_data['last_name']
            city = form.cleaned_data['city']
            state = form.cleaned_data['state']
            country = form.cleaned_data['country']
            organization = form.cleaned_data['organization']
            organizations_list = get_organizations_ordered_by_name()

            search_result_list = search_volunteers(first_name, last_name, city,
                                                   state, country,
                                                   organization)
            return render(
                request, 'volunteer/search.html', {
                    'organizations_list': organizations_list,
                    'form': form,
                    'has_searched': True,
                    'search_result_list': search_result_list
                })
    else:
        organizations_list = get_organizations_ordered_by_name()
        form = SearchVolunteerForm()

    return render(
        request, 'volunteer/search.html', {
            'organizations_list': organizations_list,
            'form': form,
            'has_searched': False
        })
예제 #2
0
파일: views.py 프로젝트: systers/vms
def search(request):
    organizations_list = get_organizations_ordered_by_name()
    if request.method == 'POST':
        form = SearchVolunteerForm(request.POST)
        if form.is_valid():
            first_name = form.cleaned_data['first_name']
            last_name = form.cleaned_data['last_name']
            city = form.cleaned_data['city']
            state = form.cleaned_data['state']
            country = form.cleaned_data['country']
            organization = form.cleaned_data['organization']
            event = form.cleaned_data['event']
            job = form.cleaned_data['job']
            search_result_list = search_volunteers(
                first_name, last_name, city, state, country, organization,
                event, job)
            return render(
                request, 'volunteer/search.html', {
                    'organizations_list': organizations_list,
                    'form': form,
                    'has_searched': True,
                    'search_result_list': search_result_list
                })
    else:
        form = SearchVolunteerForm()

    return render(
        request, 'volunteer/search.html', {
            'organizations_list': organizations_list,
            'form': form,
            'has_searched': False
        })
예제 #3
0
def volunteer_search(request):
    if request.method == 'POST':
        form = SearchVolunteerForm(request.POST)
        if form.is_valid():

            first_name = form.cleaned_data['first_name']
            last_name = form.cleaned_data['last_name']
            city = form.cleaned_data['city']
            state = form.cleaned_data['state']
            country = form.cleaned_data['country']
            organization = form.cleaned_data['organization']

            volunteer_list = search_volunteers(first_name, last_name, city,
                                               state, country, organization)
            return render(
                request, 'shift/volunteer_search.html', {
                    'form': form,
                    'has_searched': True,
                    'volunteer_list': volunteer_list
                })
    else:
        form = SearchVolunteerForm()
        volunteer_list = get_all_volunteers()

    return render(request, 'shift/volunteer_search.html', {
        'form': form,
        'has_searched': False,
        'volunteer_list': volunteer_list
    })
예제 #4
0
파일: views.py 프로젝트: ahmedsabie/vms
def volunteer_search(request):
    user = request.user
    admin = None

    try:
        admin = user.administrator
    except ObjectDoesNotExist:
        pass

    # check that an admin is logged in
    if not admin:
        return render(request, 'vms/no_admin_rights.html')
    else:
        if request.method == 'POST':
            form = SearchVolunteerForm(request.POST)
            if form.is_valid():

                first_name = form.cleaned_data['first_name']
                last_name = form.cleaned_data['last_name']
                city = form.cleaned_data['city']
                state = form.cleaned_data['state']
                country = form.cleaned_data['country']
                organization = form.cleaned_data['organization']

                volunteer_list = search_volunteers(
                        first_name,
                        last_name,
                        city,
                        state,
                        country,
                        organization
                        )
                return render(
                    request,
                    'shift/volunteer_search.html',
                    {'form': form, 'has_searched': True, 'volunteer_list': volunteer_list}
                    )
        else:
            form = SearchVolunteerForm()
            volunteer_list = get_all_volunteers()

        return render(
            request,
            'shift/volunteer_search.html',
            {'form': form, 'has_searched': False, 'volunteer_list': volunteer_list}
            )
예제 #5
0
파일: views.py 프로젝트: yaseppochi/vms
def search(request):
    if request.method == 'POST':
        form = SearchVolunteerForm(request.POST)
        if form.is_valid():

            first_name = form.cleaned_data['first_name']
            last_name = form.cleaned_data['last_name']
            city = form.cleaned_data['city']
            state = form.cleaned_data['state']
            country = form.cleaned_data['country']
            organization = form.cleaned_data['organization']

            search_result_list = search_volunteers(first_name, last_name, city, state, country, organization)
            return render(request, 'volunteer/search_result.html', {'search_result_list' : search_result_list})
    else:
        form = SearchVolunteerForm()

    return render(request, 'volunteer/search.html', {'form' : form})
예제 #6
0
파일: views.py 프로젝트: Ads7/vms
def volunteer_search(request):
    if request.method == 'POST':
        form = SearchVolunteerForm(request.POST)
        if form.is_valid():

            first_name = form.cleaned_data['first_name']
            last_name = form.cleaned_data['last_name']
            city = form.cleaned_data['city']
            state = form.cleaned_data['state']
            country = form.cleaned_data['country']
            organization = form.cleaned_data['organization']

            volunteer_list = search_volunteers(first_name, last_name, city, state, country, organization)
            return render(request, 'shift/volunteer_search.html', {'form' : form, 'has_searched' : True, 'volunteer_list' : volunteer_list})
    else:
        form = SearchVolunteerForm()
        volunteer_list = get_all_volunteers()

    return render(request, 'shift/volunteer_search.html', {'form' : form, 'has_searched' : False, 'volunteer_list' : volunteer_list})