Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

add field placeholder layout crispy modelform


def __init__(self, *args, **kwargs):
    super(FilterForm, self).__init__(*args, **kwargs)
    helper = self.helper = FormHelper()

    # Moving field labels into placeholders
    layout = helper.layout = Layout()
    for field_name, field in self.fields.items():
        layout.append(Field(field_name, placeholder=field.label))
    helper.form_show_labels = False

Source by devarama.com #
 
PREVIOUS NEXT
Tagged: #add #field #placeholder #layout #crispy #modelform
ADD COMMENT
Topic
Name
8+2 =