Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个网上商店购买视频课程。现在,我认为,我需要添加一个约束:人们可以每天(24 小时)观看一次视频课程。我怎么知道那天是否已经观看过视频文件?
创建一个新模型来映射用户和视频与观看视频的日期。然后您可以检查用户是否在当天观看了视频。
class VideoViewed(models.Model): user = models.ForeignKey(User) page = models.ForeignKey(Video) date = models.DateTimeField() manager = ResultManager()