• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python zinnia_tags.get_calendar_entries函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中zinnia.templatetags.zinnia_tags.get_calendar_entries函数的典型用法代码示例。如果您正苦于以下问题:Python get_calendar_entries函数的具体用法?Python get_calendar_entries怎么用?Python get_calendar_entries使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_calendar_entries函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_get_calendar_entries_object_context

    def test_get_calendar_entries_object_context(self):
        self.publish_entry()
        source_context = Context({'object': object()})
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEqual(
            context['previous_month'],
            self.make_local(self.entry.creation_date).date().replace(day=1))
        self.assertEqual(context['next_month'], None)

        params = {'title': 'My second entry',
                  'content': 'My second content',
                  'tags': 'zinnia, test',
                  'status': PUBLISHED,
                  'creation_date': datetime(2008, 1, 15),
                  'slug': 'my-second-entry'}
        second_entry = Entry.objects.create(**params)
        second_entry.sites.add(self.site)

        source_context = Context({'object': self.entry})
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEqual(
            context['previous_month'],
            self.make_local(second_entry.creation_date).date().replace(day=1))
        self.assertEqual(context['next_month'], None)

        source_context = Context({'object': second_entry})
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEqual(context['previous_month'], None)
        self.assertEqual(
            context['next_month'],
            self.make_local(self.entry.creation_date).date().replace(day=1))
开发者ID:ArturFis,项目名称:django-blog-zinnia,代码行数:34,代码来源:test_templatetags.py


示例2: test_get_calendar_entries_no_prev_next

 def test_get_calendar_entries_no_prev_next(self):
     self.publish_entry()
     source_context = Context()
     with self.assertNumQueries(2):
         context = get_calendar_entries(source_context, 2010, 1)
     self.assertEqual(context['previous_month'], None)
     self.assertEqual(context['next_month'], None)
开发者ID:ArturFis,项目名称:django-blog-zinnia,代码行数:7,代码来源:test_templatetags.py


示例3: test_get_calendar_entries_incomplete_year_month

    def test_get_calendar_entries_incomplete_year_month(self):
        self.publish_entry()
        source_context = Context()
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context, year=2009)
        self.assertEqual(
            context['previous_month'],
            self.make_local(self.entry.creation_date).date().replace(day=1))
        self.assertEqual(context['next_month'], None)

        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context, month=1)
        self.assertEqual(
            context['previous_month'],
            self.make_local(self.entry.creation_date).date().replace(day=1))
        self.assertEqual(context['next_month'], None)
开发者ID:ArturFis,项目名称:django-blog-zinnia,代码行数:16,代码来源:test_templatetags.py


示例4: test_get_calendar_entries_no_params

    def test_get_calendar_entries_no_params(self):
        source_context = Context()
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEqual(context['previous_month'], None)
        self.assertEqual(context['next_month'], None)
        self.assertEqual(context['template'],
                         'zinnia/tags/entries_calendar.html')

        self.publish_entry()
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEqual(
            context['previous_month'],
            self.make_local(self.entry.creation_date).date().replace(day=1))
        self.assertEqual(context['next_month'], None)
开发者ID:ArturFis,项目名称:django-blog-zinnia,代码行数:16,代码来源:test_templatetags.py


示例5: test_get_calendar_entries_day_context

 def test_get_calendar_entries_day_context(self):
     self.publish_entry()
     source_context = Context({'month': date(2009, 1, 15)})
     with self.assertNumQueries(2):
         context = get_calendar_entries(source_context)
     self.assertEqual(context['previous_month'], None)
     self.assertEqual(
         context['next_month'],
         self.make_local(self.entry.creation_date).date().replace(day=1))
开发者ID:ArturFis,项目名称:django-blog-zinnia,代码行数:9,代码来源:test_templatetags.py


示例6: test_get_calendar_entries_full_params

 def test_get_calendar_entries_full_params(self):
     self.publish_entry()
     source_context = Context()
     with self.assertNumQueries(2):
         context = get_calendar_entries(source_context, 2009, 1,
                                        template='custom_template.html')
     self.assertEqual(context['previous_month'], None)
     self.assertEqual(
         context['next_month'],
         self.make_local(self.entry.creation_date).date().replace(day=1))
     self.assertEqual(context['template'], 'custom_template.html')
开发者ID:ArturFis,项目名称:django-blog-zinnia,代码行数:11,代码来源:test_templatetags.py


示例7: test_get_calendar_entries

    def test_get_calendar_entries(self):
        source_context = Context()
        with self.assertNumQueries(3):
            context = get_calendar_entries(source_context)
        self.assertEquals(context['previous_month'], None)
        self.assertEquals(context['next_month'], None)
        self.assertEquals(context['template'], 'zinnia/tags/calendar.html')

        self.publish_entry()
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context,
                                           template='custom_template.html')
        self.assertEquals(context['previous_month'], datetime(2010, 1, 1))
        self.assertEquals(context['next_month'], None)
        self.assertEquals(context['template'], 'custom_template.html')

        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context, 2009, 1)
        self.assertEquals(context['previous_month'], None)
        self.assertEquals(context['next_month'], datetime(2010, 1, 1))

        source_context = Context({'month': datetime(2009, 1, 1)})
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEquals(context['previous_month'], None)
        self.assertEquals(context['next_month'], datetime(2010, 1, 1))

        source_context = Context({'month': datetime(2010, 1, 1)})
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEquals(context['previous_month'], None)
        self.assertEquals(context['next_month'], None)

        params = {'title': 'My second entry',
                  'content': 'My second content',
                  'tags': 'zinnia, test',
                  'status': PUBLISHED,
                  'creation_date': datetime(2008, 1, 1),
                  'slug': 'my-second-entry'}
        site = Site.objects.get_current()
        second_entry = Entry.objects.create(**params)
        second_entry.sites.add(site)

        source_context = Context()
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context, 2009, 1)
        self.assertEquals(context['previous_month'], datetime(2008, 1, 1))
        self.assertEquals(context['next_month'], datetime(2010, 1, 1))
        with self.assertNumQueries(2):
            context = get_calendar_entries(source_context)
        self.assertEquals(context['previous_month'], datetime(2010, 1, 1))
        self.assertEquals(context['next_month'], None)
开发者ID:VickiFu,项目名称:django-blog-zinnia,代码行数:52,代码来源:templatetags.py


示例8: test_get_calendar_entries

    def test_get_calendar_entries(self):
        source_context = Context()
        context = get_calendar_entries(source_context)
        self.assertEquals(context["previous_month"], None)
        self.assertEquals(context["next_month"], None)
        self.assertEquals(context["template"], "zinnia/tags/calendar.html")

        self.publish_entry()
        context = get_calendar_entries(source_context, template="custom_template.html")
        self.assertEquals(context["previous_month"], datetime(2010, 1, 1, tzinfo=timezone.utc))
        self.assertEquals(context["next_month"], None)
        self.assertEquals(context["template"], "custom_template.html")

        context = get_calendar_entries(source_context, 2009, 1)
        self.assertEquals(context["previous_month"], None)
        self.assertEquals(context["next_month"], datetime(2010, 1, 1, tzinfo=timezone.utc))
        source_context = Context({"month": datetime(2009, 1, 1)})
        context = get_calendar_entries(source_context)
        self.assertEquals(context["previous_month"], None)
        self.assertEquals(context["next_month"], datetime(2010, 1, 1, tzinfo=timezone.utc))

        source_context = Context({"month": datetime(2010, 1, 1)})
        context = get_calendar_entries(source_context)
        self.assertEquals(context["previous_month"], None)
        self.assertEquals(context["next_month"], None)

        params = {
            "title": "My second entry",
            "content": "My second content",
            "tags": "zinnia, test",
            "status": PUBLISHED,
            "creation_date": datetime(2008, 1, 1, tzinfo=timezone.utc),
            "slug": "my-second-entry",
        }
        site = Site.objects.get_current()
        second_entry = Entry.objects.create(**params)
        second_entry.sites.add(site)

        source_context = Context()
        context = get_calendar_entries(source_context, 2009, 1)
        self.assertEquals(context["previous_month"], datetime(2008, 1, 1, tzinfo=timezone.utc))
        self.assertEquals(context["next_month"], datetime(2010, 1, 1, tzinfo=timezone.utc))
        context = get_calendar_entries(source_context)
        self.assertEquals(context["previous_month"], datetime(2010, 1, 1, tzinfo=timezone.utc))
        self.assertEquals(context["next_month"], None)
开发者ID:aparo,项目名称:django-blog-zinnia,代码行数:45,代码来源:templatetags.py



注:本文中的zinnia.templatetags.zinnia_tags.get_calendar_entries函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vocabulary.SimpleVocabulary类代码示例发布时间:2022-05-27
下一篇:
Python year.is_leap_year函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap