我正在构建一个具有“故事功能”的应用程序,该功能与 Instagram 的故事功能非常相似,因此我想在创建 24 小时后删除故事。因此,如果一个故事是在 2021 年 1 月 1 日中午 12:00 创建的,我想在 2021 年 1 月 2 日中午 12:00 自动删除它。我使用的是 django3.1
我的型号:
class Story(models.Model):
user = models.ForeignKey(to=User, on_delete=models.CASCADE)
text = models.CharField(max_length=200)
image = models.ImageField(blank=True, null=True)
video = models.FielField(blank=True, null=True)
created_at = models.DateTimeField(auto_now_add=True)
expiration_time = models.DateTimeField()
Run Code Online (Sandbox Code Playgroud)
我想在特定的过期时间后删除每条记录。
[过期时间在 post_save 函数中设置]
我一直在使用 python tkinter 制作一些 gui 应用程序。在 tkinter 中,pack 和 grid 不能一起使用。在编写代码时,我必须使用 pack,然后我需要使用 2 个名为“Cloumn”和“row”的网格功能,但是是不可能的。
from tkinter import *
root = Tk()
button = Button(root, text="Click Me")
button.pack(side="bottom") #But I want to put that button in row=3
root.mainloop()
Run Code Online (Sandbox Code Playgroud)
我需要将该按钮放在第 3 行。但是我该怎么做呢?有什么办法可以做到吗?