請,麻煩幫忙:Django的 - 過濾器(__icontains)不起作用
class SearchResultView(TemplateView):
template_name = "search_result.html"
def get_context_data(self, **kwargs):
context = super(SearchResultView, self).get_context_data(**kwargs)
location = self.request.GET['location']
locations_searched = Location.objects.filter(name__icontains=location)
context['locations_searched'] = locations_searched
return context
class AdvancedSearchForm(forms.Form):
location = forms.CharField(label=u"Локация:")
當位置字段中輸入大寫的話,我可以看到導致的觀點,而不是資本的時候 - 沒有在顯示查看
謝謝!
您是否正在使用SQlite數據庫? – solarissmoke