本文整理匯總了Python中rest_framework.serializers.ImageField方法的典型用法代碼示例。如果您正苦於以下問題:Python serializers.ImageField方法的具體用法?Python serializers.ImageField怎麽用?Python serializers.ImageField使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rest_framework.serializers
的用法示例。
在下文中一共展示了serializers.ImageField方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from rest_framework import serializers [as 別名]
# 或者: from rest_framework.serializers import ImageField [as 別名]
def __init__(self, geometry_string, options={}, *args, **kwargs):
"""
Create an instance of the HyperlinkedSorlImageField image serializer.
Args:
geometry_string (str): The size of your cropped image.
options (Optional[dict]): A dict of sorl options.
*args: (Optional) Default serializers.ImageField arguments.
**kwargs: (Optional) Default serializers.ImageField keyword
arguments.
For a description of sorl geometry strings and additional sorl options,
please see https://sorl-thumbnail.readthedocs.org/en/latest/examples.html?highlight=geometry#low-level-api-examples
""" # NOQA
self.geometry_string = geometry_string
self.options = options
super(HyperlinkedSorlImageField, self).__init__(*args, **kwargs)
示例2: test_should_image_convert_string
# 需要導入模塊: from rest_framework import serializers [as 別名]
# 或者: from rest_framework.serializers import ImageField [as 別名]
def test_should_image_convert_string():
assert_conversion(serializers.ImageField, graphene.String)