本文整理汇总了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)