from django.http import HttpResponse
from django.shortcuts import render, redirect
from community.models import Community


# Create your views here.

def search_basic(request):
    communities = None
    if request.POST:
        community_query = request.POST.get('community_search', False)
        communities = Community.objects.filter(city__icontains=community_query)
        print(communities)
        return render(request, 'search/search_basic.html', {'communities': communities})
    return render(request, 'search/search_basic.html', {'communities': communities})




[((15, 11, 15, 84), 'django.shortcuts.render', 'render', ({(15, 18, 15, 25): 'request', (15, 27, 15, 53): '"""search/search_basic.html"""', (15, 55, 15, 83): "{'communities': communities}"}, {}), "(request, 'search/search_basic.html', {'communities': communities})", False, 'from django.shortcuts import render, redirect\n'), ((12, 22, 12, 79), 'community.models.Community.objects.filter', 'Community.objects.filter', (), '', False, 'from community.models import Community\n'), ((14, 15, 14, 88), 'django.shortcuts.render', 'render', ({(14, 22, 14, 29): 'request', (14, 31, 14, 57): '"""search/search_basic.html"""', (14, 59, 14, 87): "{'communities': communities}"}, {}), "(request, 'search/search_basic.html', {'communities': communities})", False, 'from django.shortcuts import render, redirect\n')]