Make BooleanField display a larger checkbox in Django

So I am creating a website using Django templates, forms etc. One thing I've noticed though is that the checkboxes I create via BooleanFields are too small. Any idea how to make the thing bigger?

Answers


You can try doing this using css, but the thing is very difficult: http://www.456bereastreet.com/lab/form_controls/checkboxes/

When you create a class in css you can add it to your input using widgets, something like:

field = forms.BooleanField(widget=forms.CheckboxInput(attrs={'class':'your_class'}))

I found below is easier and works for me:

class Meta:
        ...
        widgets = {
            'my_checkbox': forms.CheckboxInput(attrs={'style':'width:20px;height:20px;'}),
        }

Need Your Help

c++ iostream - output file is not created

c++ iostream

I added some commands to produce an output file in methods of a given class. This worked perfectly well, and output file was produced during execution. Now that I made major changes to the code (bu...

Connect to HTTPS web service from Azure

asp.net web-services azure ssl-certificate

I have a web role in Azure that has to connect to an SSL-secured external web service. When the application tries to connect to the web service, it's giving an error: