import floppyforms as forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, Field, ButtonHolder

from .models import UserQuestion


class ContactForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(ContactForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Field('name'),
            Field('email'),
            Field('body'),
            ButtonHolder(
                Submit('submit', 'Contact', css_class="col-md-4 col-xs-4 col-xs-offset-4 col-md-offset-4 btn-fill")
            )
        )

    class Meta:
        model = UserQuestion
        fields = (
            'name',
            'email',
            'body'
        )
