dimanche 22 août 2021

How to change default background of checkbox using flask and wtforms?

I don't understand where to add the class name so I can change the background color of the checkbox.

form.py

DOMAINS = ['Bakeries', 'Bars and Pubs', 'Butcher Shops', 'Electronics', 'Fashion', 'Fish Shops',
       'Flowers', 'Furniture', 'Gelaterias and Sweets', 'Pets', 'Other', 'Restaurants and Cafés', 'Sport',
       'Supermarkets', 'Vegetables and Fruits']

class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
option_widget = widgets.CheckboxInput()

class BuyerForm(FlaskForm):
address = StringField(label='Address', validators=[InputRequired()])
domains_fields = [(x, x) for x in DOMAINS]
domains = MultiCheckboxField(label='Domains', choices=domains_fields)
radius = DecimalRangeField(label='Radius (KM)', default=5, validators=[InputRequired()])
submit = SubmitField(label='Search')

buyer_form.html

            <div class="form-group">
                
                
                    
                
            </div>

I'm looking where to add:

CSS file

.container input:checked ~ .checkmark {
  background-color: #e86875;
}

(I took it from w3school)




Aucun commentaire:

Enregistrer un commentaire