类视图一个视图只能对于一个方法么? 而且方法的名字必须是get么?
如果能定义多个方法, url部分该如何书写?
class LessonFourPageTwo(View):
def get(self, request):
data = {}
search = request.GET.get('search','')
if search:
messages = Message.objects.filter(content__contains=search)
else:
messages = Message.objects.all()
data['messages'] = messages
return render(request, 'four_page_two.html', data)