Esempio n. 1
0
File: forms.py Progetto: 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()
Esempio n. 2
0
class ImageFormatChoiceBlock(FieldBlock):
    field = forms.ChoiceField(choices=[(format.name, format.label)
                                       for format in get_image_formats()])
Esempio n. 3
0
def get_all_image_formats():
    return [{
        'label': str(f.label),
        'value': f.name
    } for f in get_image_formats()]