摘要:
对数据库表添加新字段时执行makemigrations: Please select a fix: Provide a one-off default now (will be set on all existing rows with a null value for this column) 提 阅读全文
摘要:
创建django的model时,有DateTimeField、DateField和TimeField三种类型可以用来创建日期字段,其值分别对应着datetime()、date()、time()三中对象。这三个field有着相同的参数auto_now和auto_now_add,表面上看起来很easy, 阅读全文
摘要:
1.先将数据排序然后用正切片取前面的几条数据例如这样 new_data=Book_detail.objects.filter(book_id=book_id).order_by('-id')[:5]order_by()默认是升序排列,加上‘-’就是降序排列,我这里以id进行降序排列,取前5项,不同情 阅读全文