本文整理汇总了Python中core.models.AFourthMockModel.author方法的典型用法代码示例。如果您正苦于以下问题:Python AFourthMockModel.author方法的具体用法?Python AFourthMockModel.author怎么用?Python AFourthMockModel.author使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.models.AFourthMockModel
的用法示例。
在下文中一共展示了AFourthMockModel.author方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import author [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)
示例2: setUp
# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import author [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)
示例3: setUp
# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import author [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)
示例4: setUp
# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import author [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)
示例5: setUp
# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import author [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)
示例6: setUp
# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import author [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)
示例7: setUp
# 需要导入模块: from core.models import AFourthMockModel [as 别名]
# 或者: from core.models.AFourthMockModel import author [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)