本文整理汇总了Python中treemap.models.Plot.udfs['Test+choice']方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.udfs['Test+choice']方法的具体用法?Python Plot.udfs['Test+choice']怎么用?Python Plot.udfs['Test+choice']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treemap.models.Plot
的用法示例。
在下文中一共展示了Plot.udfs['Test+choice']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from treemap.models import Plot [as 别名]
# 或者: from treemap.models.Plot import udfs['Test+choice'] [as 别名]
def setUp(self):
super(ExportTreeTaskTest, self).setUp()
set_write_permissions(self.instance, self.user,
'Plot', ['udf:Test choice'])
set_write_permissions(self.instance, self.user,
'Tree', ['udf:Test int'])
UserDefinedFieldDefinition.objects.create(
instance=self.instance,
model_type='Plot',
datatype=json.dumps({'type': 'choice',
'choices': ['a', 'b', 'c']}),
iscollection=False,
name='Test choice')
UserDefinedFieldDefinition.objects.create(
instance=self.instance,
model_type='Tree',
datatype=json.dumps({'type': 'int'}),
iscollection=False,
name='Test int')
p = Plot(geom=self.instance.center, instance=self.instance,
address_street="123 Main Street")
p.udfs['Test choice'] = 'a'
p.save_with_user(self.user)
t = Tree(plot=p, instance=self.instance, diameter=2)
t.udfs['Test int'] = 4
t.save_with_user(self.user)
示例2: create_and_save_with_choice
# 需要导入模块: from treemap.models import Plot [as 别名]
# 或者: from treemap.models.Plot import udfs['Test+choice'] [as 别名]
def create_and_save_with_choice(c, n=1):
plots = []
for i in xrange(n):
plot = Plot(geom=self.p, instance=self.instance)
plot.udfs['Test choice'] = c
plot.save_with_user(self.commander_user)
plots.append(plot)
return {plot.pk for plot in plots}
示例3: assert_plot_udf_template
# 需要导入模块: from treemap.models import Plot [as 别名]
# 或者: from treemap.models.Plot import udfs['Test+choice'] [as 别名]
def assert_plot_udf_template(self, user, template_text, value):
plot = Plot(length=12.3, instance=self.instance)
plot.udfs['Test choice'] = 'b'
template = self._form_template_with_request_user_for(
'plot.udf:Test choice')
self._write_field_template(template_text)
with self.settings(TEMPLATE_DIRS=(self.template_dir,)):
content = template.render(Context({
'request': {'user': user},
'plot': plot})).strip()
self.assertEqual(content, value)