예제 #1
0
파일: forms.py 프로젝트: xus/wagtail
class ImageInsertionForm(forms.Form):
    """
    Form for selecting parameters of the image (e.g. format) prior to insertion
    into a rich text area
    """
    format = forms.ChoiceField(choices=[(format.name, format.label)
                                        for format in get_image_formats()],
                               widget=forms.RadioSelect)
    alt_text = forms.CharField()
예제 #2
0
class ImageFormatChoiceBlock(FieldBlock):
    field = forms.ChoiceField(choices=[(format.name, format.label)
                                       for format in get_image_formats()])
예제 #3
0
def get_all_image_formats():
    return [{
        'label': str(f.label),
        'value': f.name
    } for f in get_image_formats()]