fields.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:wagtailvideos 作者: takeflight 项目源码 文件源码
def __init__(self, *args, **kwargs):
        super(WagtailVideoField, self).__init__(*args, **kwargs)

        # Get max upload size from settings
        self.max_upload_size = getattr(settings, 'WAGTAILVIDEOS_MAX_UPLOAD_SIZE', 1024 * 1024 * 1024)
        max_upload_size_text = filesizeformat(self.max_upload_size)

        # Help text
        if self.max_upload_size is not None:
            self.help_text = _(
                "Maximum filesize: %(max_upload_size)s."
            ) % {
                'max_upload_size': max_upload_size_text,
            }

        # Error messages
        self.error_messages['invalid_video_format'] = _(
            "Not a valid video. Content type was %s."
        )

        self.error_messages['file_too_large'] = _(
            "This file is too big (%%s). Maximum filesize %s."
        ) % max_upload_size_text

        self.error_messages['file_too_large_unknown_size'] = _(
            "This file is too big. Maximum filesize %s."
        ) % max_upload_size_text
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号