from django import forms

from ..models import CommentFlag


class CommentFlagForm(forms.ModelForm):
    class Meta:
        model = CommentFlag
        fields = ("is_closed",)

    def __init__(self, user=None, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.user = user

    def save(self, commit=True):
        self.instance.moderator = self.user
        return super().save(commit)
