我想要一个谓词:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(self isKindOfClass: %@ || self isKindOfClass: %@) AND isActive == YES", [TestClass1 class], [TestClass2 class]];
但是()不像我想的那样工作,就像它在if stmt中一样:
if ((condition1 || condition2) && otherCondition) {
}
如果'condition1'或'condition2'为真加上'otherCondition'为真,则stmt为真。
我可以使用NSPredicate
吗?
答案 0 :(得分:1)
def update_session(request):
if not request.is_ajax() or not request.method=='POST':
return HttpResponseNotAllowed(['POST'])
request.session['mykey'] = 'myvalue'
return HttpResponse('ok')