请麻烦帮忙:
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"???????:")
Run Code Online (Sandbox Code Playgroud)
在“位置”字段中输入大写单词时,我可以在视图中看到结果,但是如果没有大写,则视图中不会显示任何内容
谢谢!
| 归档时间: |
|
| 查看次数: |
1669 次 |
| 最近记录: |