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})




[((499, 572), 'django.shortcuts.render', 'render', (['request', '"""search/search_basic.html"""', "{'communities': communities}"], {}), "(request, 'search/search_basic.html', {'communities': communities})\n", (505, 572), False, 'from django.shortcuts import render, redirect\n'), ((314, 371), 'community.models.Community.objects.filter', 'Community.objects.filter', ([], {'city__icontains': 'community_query'}), '(city__icontains=community_query)\n', (338, 371), False, 'from community.models import Community\n'), ((414, 487), 'django.shortcuts.render', 'render', (['request', '"""search/search_basic.html"""', "{'communities': communities}"], {}), "(request, 'search/search_basic.html', {'communities': communities})\n", (420, 487), False, 'from django.shortcuts import render, redirect\n')]