本文整理汇总了Python中treemap.models.Plot.udfs['times+climbed']方法的典型用法代码示例。如果您正苦于以下问题:Python Plot.udfs['times+climbed']方法的具体用法?Python Plot.udfs['times+climbed']怎么用?Python Plot.udfs['times+climbed']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类treemap.models.Plot
的用法示例。
在下文中一共展示了Plot.udfs['times+climbed']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pending_udf_audits
# 需要导入模块: from treemap.models import Plot [as 别名]
# 或者: from treemap.models.Plot import udfs['times+climbed'] [as 别名]
def test_pending_udf_audits(self):
UserDefinedFieldDefinition.objects.create(
instance=self.instance,
model_type='Plot',
datatype=json.dumps({'type': 'choice',
'choices': ['1', '2', '3']}),
iscollection=False,
name='times climbed')
set_write_permissions(self.instance, self.commander_user,
'Plot', ['udf:times climbed'])
FieldPermission.objects.create(
model_name='Plot',
field_name='udf:times climbed',
permission_level=FieldPermission.WRITE_WITH_AUDIT,
role=self.pending_user.get_instance_user(self.instance).role,
instance=self.instance)
initial_plot = Plot(geom=self.p1, instance=self.instance)
initial_plot.udfs['times climbed'] = '2'
initial_plot.save_with_user(self.pending_user)
udf_audit = Audit.objects.get(model='Plot', field='udf:times climbed',
model_id=initial_plot.pk)
approve_or_reject_audit_and_apply(udf_audit, self.commander_user,
approved=True)
geom_audit = Audit.objects.get(model='Plot', field='geom',
model_id=initial_plot.pk)
approve_or_reject_audit_and_apply(geom_audit, self.commander_user,
approved=True)
readonly_audit = Audit.objects.get(model='Plot', field='readonly',
model_id=initial_plot.pk)
approve_or_reject_audit_and_apply(readonly_audit,
self.commander_user, approved=True)
insert_audit = Audit.objects.get(model='Plot', field='id',
model_id=initial_plot.pk)
approve_or_reject_audit_and_apply(insert_audit,
self.commander_user, approved=True)
new_plot = Plot.objects.get(pk=initial_plot.pk)
self.assertEqual(new_plot.pk, initial_plot.pk)
self.assertEqual(new_plot.readonly, False)
self.assertEqual(new_plot.geom, self.p1)
self.assertEqual(new_plot.udfs['times climbed'], '2')