我正在尝试使用嵌套 if 做一个项目。但它不起作用。为什么?我的代码是,
schedule = Schedule.objects.all()
for c in schedule :
p = c.poll
e = c.end_time
s = c.start_time
n = c.no_of_response
now = timezone.now()
#phn = Response.objects.filter(poll = p).exclude(sid = 'Null').count()
if (c.start_time <= now) & (now <= c.end_time):
if n == 0:
c.poll.status='Running'
c.poll.save()