class event_archive(models.Model):
event_id = models.AutoField(primary_key=True)
date_submitted = models.DateTimeField()
event_start_time = models.DateTimeField()
event_end_time = models.DateTimeField()
event_closed = models.BooleanField()
我想这样做:这是伪代码:
event = event_archive.objects.all()
for e in event:
if event_start_time > datetime_now()
print "upcoming";
elif event_start_time < datetime_now() < event_end_time
print "now";
elif event_end_time < datetime_now() < **24 hours passed the event ends**
print "%d hours ago",%hour;
elif event_end_time < datetime_now() > **24 hours passed the event ends** and event_end_time < datetime_now() < **48 hours passed the event ends**
print "yesterday";
else
print "recorded"
endif;
endfor;
** 我在编程和 python 方面很新。如果我问了非常愚蠢的问题或没有明确提出问题,请不要介意。在粗线中我不确定我应该使用什么?
我需要帮助来编写我的 django 视图功能..请提供任何帮助..