from django import forms


from aircox import models


__all__ = ("CommentForm", "ImageForm", "PageForm", "ChildPageForm")


class CommentForm(forms.ModelForm):
    nickname = forms.CharField()
    email = forms.EmailField(required=False)
    content = forms.CharField(widget=forms.Textarea())

    nickname.widget.attrs.update({"class": "input"})
    email.widget.attrs.update({"class": "input"})
    content.widget.attrs.update({"class": "textarea"})

    class Meta:
        model = models.Comment
        fields = ["nickname", "email", "content"]


class ImageForm(forms.Form):
    file = forms.ImageField()


class PageForm(forms.ModelForm):
    class Meta:
        fields = ("title", "category", "status", "cover", "content")
        model = models.Page


class ChildPageForm(forms.ModelForm):
    class Meta:
        fields = ("title", "status", "cover", "content")
        model = models.Page
