本文整理汇总了Python中group.Group.fields方法的典型用法代码示例。如果您正苦于以下问题:Python Group.fields方法的具体用法?Python Group.fields怎么用?Python Group.fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类group.Group
的用法示例。
在下文中一共展示了Group.fields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import fields [as 别名]
def set(self, record, value):
from group import Group
group = record.value.get(self.name)
fields = {}
if group is not None:
fields = group.fields.copy()
# Unconnect to prevent infinite loop
group.signal_unconnect(group)
group.destroy()
elif record.model_name == self.attrs['relation']:
fields = record.group.fields
parent_name = self.attrs.get('relation_field', '')
group = Group(self.attrs['relation'], {},
parent=record, parent_name=parent_name,
child_name=self.name,
context=self.context,
parent_datetime_field=self.attrs.get('datetime_field'))
if record.value.get(self.name):
group.record_removed.extend(record.value[self.name])
group.record_deleted.extend(record.value[self.name].record_deleted)
group.record_removed.extend(record.value[self.name].record_removed)
record.value[self.name] = group
group.fields = fields
group.load(value)
group.signal_connect(group, 'group-changed', self._group_changed)
group.signal_connect(group, 'group-list-changed',
self._group_list_changed)
group.signal_connect(group, 'group-cleared', self._group_cleared)
group.signal_connect(group, 'record-modified', self._record_modified)
示例2: _set_default_value
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import fields [as 别名]
def _set_default_value(self, record, fields=None):
if record.value.get(self.name) is not None:
return
from group import Group
parent_name = self.attrs.get('relation_field', '')
fields = fields or {}
context = record.expr_eval(self.attrs.get('context', {}))
group = Group(self.attrs['relation'], fields,
parent=record,
parent_name=parent_name,
child_name=self.name,
context=context,
parent_datetime_field=self.attrs.get('datetime_field'))
if not fields and record.model_name == self.attrs['relation']:
group.fields = record.group.fields
record.value[self.name] = group
self._connect_value(group)
示例3: _set_default_value
# 需要导入模块: from group import Group [as 别名]
# 或者: from group.Group import fields [as 别名]
def _set_default_value(self, record):
if record.value.get(self.name) is not None:
return
from group import Group
parent_name = self.attrs.get('relation_field', '')
group = Group(self.attrs['relation'], {},
parent=record,
parent_name=parent_name,
child_name=self.name,
context=self.context,
parent_datetime_field=self.attrs.get('datetime_field'))
if record.model_name == self.attrs['relation']:
group.fields = record.group.fields
group.signal_connect(group, 'group-changed', self._group_changed)
group.signal_connect(group, 'group-list-changed',
self._group_list_changed)
group.signal_connect(group, 'group-cleared', self._group_cleared)
group.signal_connect(group, 'record-modified', self._record_modified)
record.value[self.name] = group