当前位置: 首页>>代码示例>>Python>>正文


Python AFourthMockModel.id方法代码示例

本文整理汇总了Python中core.models.AFourthMockModel.id方法的典型用法代码示例。如果您正苦于以下问题:Python AFourthMockModel.id方法的具体用法?Python AFourthMockModel.id怎么用?Python AFourthMockModel.id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.models.AFourthMockModel的用法示例。


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

示例1: setUp

# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import id [as 别名]
    def setUp(self):
        super(SolrBoostBackendTestCase, self).setUp()

        # Wipe it clean.
        self.raw_solr = pysolr.Solr(settings.HAYSTACK_CONNECTIONS['default']['URL'])
        clear_solr_index()

        # Stow.
        self.old_ui = connections['default'].get_unified_index()
        self.ui = UnifiedIndex()
        self.smmi = SolrBoostMockSearchIndex()
        self.ui.build(indexes=[self.smmi])
        connections['default']._index = self.ui
        self.sb = connections['default'].get_backend()

        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i

            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'

            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)
开发者ID:Sanoma-Media-Games,项目名称:django-haystack,代码行数:32,代码来源:solr_backend.py

示例2: setUp

# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import id [as 别名]
    def setUp(self):
        super(XapianBoostBackendTestCase, self).setUp()

        self.site = SearchSite()
        self.sb = SearchBackend(site=self.site)
        self.smmi = XapianBoostMockSearchIndex(AFourthMockModel, backend=self.sb)
        self.site.register(AFourthMockModel, XapianBoostMockSearchIndex)

        # Stow.
        import haystack
        self.old_site = haystack.site
        haystack.site = self.site

        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i
            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'
            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)
开发者ID:dcolish,项目名称:xapian-haystack,代码行数:28,代码来源:xapian_backend.py

示例3: setUp

# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import id [as 别名]
    def setUp(self):
        super(WhooshBoostBackendTestCase, self).setUp()

        # Stow.
        temp_path = os.path.join('tmp', 'test_whoosh_query')
        self.old_whoosh_path = settings.HAYSTACK_CONNECTIONS['default']['PATH']
        settings.HAYSTACK_CONNECTIONS['default']['PATH'] = temp_path

        self.old_ui = connections['default'].get_unified_index()
        self.ui = UnifiedIndex()
        self.wmmi = WhooshBoostMockSearchIndex()
        self.ui.build(indexes=[self.wmmi])
        self.sb = connections['default'].get_backend()
        connections['default']._index = self.ui

        self.sb.setup()
        self.raw_whoosh = self.sb.index
        self.parser = QueryParser(self.sb.content_field_name, schema=self.sb.schema)
        self.sb.delete_index()
        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i

            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'

            mock.pub_date = date(2009, 2, 25) - timedelta(days=i)
            self.sample_objs.append(mock)
开发者ID:5monkeys,项目名称:django-haystack,代码行数:36,代码来源:whoosh_backend.py

示例4: setUp

# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import id [as 别名]
 def setUp(self):
     super(SolrBoostBackendTestCase, self).setUp()
     
     # Wipe it clean.
     self.raw_solr = pysolr.Solr(settings.HAYSTACK_SOLR_URL)
     clear_solr_index()
     
     self.site = SearchSite()
     self.sb = SearchBackend(site=self.site)
     self.smmi = SolrBoostMockSearchIndex(AFourthMockModel, backend=self.sb)
     self.site.register(AFourthMockModel, SolrBoostMockSearchIndex)
     
     # Stow.
     import haystack
     self.old_site = haystack.site
     haystack.site = self.site
     self.sample_objs = []
     
     for i in xrange(1, 5):
         mock = AFourthMockModel()
         mock.id = i
         
         if i % 2:
             mock.author = 'daniel'
             mock.editor = 'david'
         else:
             mock.author = 'david'
             mock.editor = 'daniel'
         
         mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
         self.sample_objs.append(mock)
开发者ID:concentricsky,项目名称:django-haystack,代码行数:33,代码来源:solr_backend.py

示例5: setUp

# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import id [as 别名]
    def setUp(self):
        super(BoostFieldTestCase, self).setUp()

        self.sample_objs = []
        for i in range(1, 5):
            mock = AFourthMockModel()
            mock.id = i
            if i % 2:
                mock.author = "daniel"
                mock.editor = "david"
            else:
                mock.author = "david"
                mock.editor = "daniel"
            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)

        self.backend.update(self.index, self.sample_objs)
开发者ID:josezambrana,项目名称:xapian-haystack,代码行数:19,代码来源:test_query.py

示例6: setUp

# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import id [as 别名]
 def setUp(self):
     super(WhooshBoostBackendTestCase, self).setUp()
     
     # Stow.
     temp_path = os.path.join('tmp', 'test_whoosh_query')
     self.old_whoosh_path = getattr(settings, 'HAYSTACK_WHOOSH_PATH', temp_path)
     settings.HAYSTACK_WHOOSH_PATH = temp_path
     
     self.site = SearchSite()
     self.sb = SearchBackend(site=self.site)
     self.smmi = WhooshBoostMockSearchIndex(AFourthMockModel, backend=self.sb)
     self.site.register(AFourthMockModel, WhooshBoostMockSearchIndex)
     
     # With the models registered, you get the proper bits.
     import haystack
     
     # Stow.
     self.old_site = haystack.site
     haystack.site = self.site
     
     self.sb.setup()
     self.raw_whoosh = self.sb.index
     self.parser = QueryParser(self.sb.content_field_name, schema=self.sb.schema)
     self.sb.delete_index()
     self.sample_objs = []
     
     for i in xrange(1, 5):
         mock = AFourthMockModel()
         mock.id = i
         
         if i % 2:
             mock.author = 'daniel'
             mock.editor = 'david'
         else:
             mock.author = 'david'
             mock.editor = 'daniel'
         
         mock.pub_date = date(2009, 2, 25) - timedelta(days=i)
         self.sample_objs.append(mock)
开发者ID:emou,项目名称:django-haystack,代码行数:41,代码来源:whoosh_backend.py

示例7: setUp

# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import id [as 别名]
    def setUp(self):
        super(XapianBoostBackendTestCase, self).setUp()

        # Stow.
        self.old_ui = connections['default'].get_unified_index()
        self.ui = UnifiedIndex()
        self.index = XapianBoostMockSearchIndex()
        self.ui.build(indexes=[self.index])
        self.sb = connections['default'].get_backend()
        connections['default']._index = self.ui

        self.sample_objs = []

        for i in xrange(1, 5):
            mock = AFourthMockModel()
            mock.id = i
            if i % 2:
                mock.author = 'daniel'
                mock.editor = 'david'
            else:
                mock.author = 'david'
                mock.editor = 'daniel'
            mock.pub_date = datetime.date(2009, 2, 25) - datetime.timedelta(days=i)
            self.sample_objs.append(mock)
开发者ID:Clever-Promo,项目名称:xapian-haystack,代码行数:26,代码来源:xapian_backend.py


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