from django import forms

from .models import Item


class ItemForm(forms.ModelForm):
    """Form for creating and updating Items."""

    class Meta:
        model = Item
        fields = ["title", "description", "is_active"]
        widgets = {
            "title": forms.TextInput(attrs={
                "class": "form-control",
                "placeholder": "Enter title",
            }),
            "description": forms.Textarea(attrs={
                "class": "form-control",
                "placeholder": "Enter description",
                "rows": 4,
            }),
            "is_active": forms.CheckboxInput(attrs={
                "class": "form-check-input",
            }),
        }
