models.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:instanotifier 作者: AlexanderKaluzhny 项目源码 文件源码
def get_dates_only(self):
        """ Returns the queryset containing entries having the date field only.
            Date is a trunc of a published_parsed datetime field.
        """

        # NOTE: order_by influences the distinct() results here
        date_times = RssNotification.objects.annotate(
            published_parsed_date=Trunc('published_parsed', 'day', output_field=DateField()),
            plain_field=F('published_parsed')
        ).values(
            'published_parsed_date'
        ).distinct().filter(plain_field__isnull=False).order_by(
            '-published_parsed_date'
        ).annotate(dates_count=Count('published_parsed'))

        return date_times
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号