render_to search_people html def search_people request if request meth

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
@render_to('search_people.html')
def search_people(request):
if request.method == 'POST':
form = SearchPeopleForm(request.POST)
if form.is_valid():
first_name = request.POST['first_name']
last_name = request.POST['last_name']
gender = request.POST['gender']
min_age = request.POST['min_age']
max_age = request.POST['max_age']
country = request.POST['country']
city = request.POST['city']
resultes = Profile.objects.filter(Q(user__first_name=first_name, gender=gender) | \
Q(user__last_name=last_name) | \
Q(country__id=country)).distinct()
return
form = SearchPeopleForm()
return {'form': form}