I'm using django-simple-captcha and crispy form
Here is my code:
forms.py
from django import forms
from captcha.fields import CaptchaField
class ContactEntryForm(forms.Form):
name = forms.CharField(
label="",
widget=forms.TextInput(attrs={'placeholder': 'Full Name'})
)
email = forms.CharField(
label="",
widget=forms.TextInput(attrs={'placeholder': 'Email', 'type': 'email'})
)
subject = forms.CharField(
label="",
widget=forms.TextInput(attrs={'placeholder': 'Subject'})
)
message = forms.CharField(
label="",
widget=forms.Textarea(attrs={'placeholder': 'Message', 'rows': 5})
)
captcha = CaptchaField()
page.html
<form method="POST">
{% csrf_token %} {{ contact_entry_form|crispy }}
<input type="submit" value="Submit" class="btn btn-dark" style="width: 100%" />
</form>
But the image and text fields in the captcha section are too narrow. I want to add some margin between the image and text field. Can I do some HTML formatting on forms.py? For example:
captcha = CaptchaField(attrs={'style': 'margin:10px'})
Or is there any better solution to add some margin from forms.py?
