本文整理匯總了Python中rest_framework.compat.OrderedDict.values方法的典型用法代碼示例。如果您正苦於以下問題:Python OrderedDict.values方法的具體用法?Python OrderedDict.values怎麽用?Python OrderedDict.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rest_framework.compat.OrderedDict
的用法示例。
在下文中一共展示了OrderedDict.values方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: BindingDict
# 需要導入模塊: from rest_framework.compat import OrderedDict [as 別名]
# 或者: from rest_framework.compat.OrderedDict import values [as 別名]
class BindingDict(object):
"""
This dict-like object is used to store fields on a serializer.
This ensures that whenever fields are added to the serializer we call
`field.bind()` so that the `field_name` and `parent` attributes
can be set correctly.
"""
def __init__(self, serializer):
self.serializer = serializer
self.fields = OrderedDict()
def __setitem__(self, key, field):
self.fields[key] = field
field.bind(field_name=key, parent=self.serializer)
def __getitem__(self, key):
return self.fields[key]
def __delitem__(self, key):
del self.fields[key]
def items(self):
return self.fields.items()
def keys(self):
return self.fields.keys()
def values(self):
return self.fields.values()