# Path: comments_spamfighter/models.py
# class Keyword(models.Model):
# 
#     # Default field choices. These are good inital values for the default
#     # Django comments but you can override it using the settings variable
#     # COMMENTS_CHECK_FIELDS_CHOICES
# 
#     FIELD_CHOICES = (
#         ("user_name", _("Username")),
#         ("user_email", _("User Email")),
#         ("user_url", _("User URL")),
#         ("comment", _("Comment text")),
#         ("ip_address", _("IP Address")),
#     )
#     FIELD_CHOICES = getattr(settings, "COMMENTS_CHECK_FIELDS_CHOICES", FIELD_CHOICES)
# 
#     active = models.BooleanField(_("Active"), default=True)
#     keyword = models.TextField(_("Keyword"))
#     is_regex = models.BooleanField(_("Is a regular expression"), default=False)
#     fields = models.TextField(_("Fields to check"), max_length=255)
#     created = models.DateTimeField(_("Created"), auto_now_add=True)
#     modified = models.DateTimeField(_("Modified"), auto_now=True)
# 
#     class Meta:
#         ordering = ("keyword", "created")
#         verbose_name = _("Keyword")
#         verbose_name_plural = _("Keywords")
# 
#     def __str__(self):
#         return self.keyword


import re
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .models import Keyword




class KeywordAdminForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(KeywordAdminForm, self).__init__(*args, **kwargs)
        self.initial["fields"] = self.instance.fields.split(",")

    keyword = forms.CharField(
        widget=forms.Textarea(
            attrs={
                "style": "height: 1.5em; line-height: 1.5em; width: 40em;",
                "class": "vLargeTextField",
            }
        )
    )

# Path: comments_spamfighter/models.py
# class Keyword(models.Model):
# 
#     # Default field choices. These are good inital values for the default
#     # Django comments but you can override it using the settings variable
#     # COMMENTS_CHECK_FIELDS_CHOICES
# 
#     FIELD_CHOICES = (
#         ("user_name", _("Username")),
#         ("user_email", _("User Email")),
#         ("user_url", _("User URL")),
#         ("comment", _("Comment text")),
#         ("ip_address", _("IP Address")),
#     )
#     FIELD_CHOICES = getattr(settings, "COMMENTS_CHECK_FIELDS_CHOICES", FIELD_CHOICES)
# 
#     active = models.BooleanField(_("Active"), default=True)
#     keyword = models.TextField(_("Keyword"))
#     is_regex = models.BooleanField(_("Is a regular expression"), default=False)
#     fields = models.TextField(_("Fields to check"), max_length=255)
#     created = models.DateTimeField(_("Created"), auto_now_add=True)
#     modified = models.DateTimeField(_("Modified"), auto_now=True)
# 
#     class Meta:
#         ordering = ("keyword", "created")
#         verbose_name = _("Keyword")
#         verbose_name_plural = _("Keywords")
# 
#     def __str__(self):
#         return self.keyword


# Path: comments_spamfighter/admin.py
import re
from django import forms
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from .models import Keyword





class KeywordAdminForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(KeywordAdminForm, self).__init__(*args, **kwargs)
        self.initial["fields"] = self.instance.fields.split(",")

    keyword = forms.CharField(
        widget=forms.Textarea(
            attrs={
                "style": "height: 1.5em; line-height: 1.5em; width: 40em;",
                "class": "vLargeTextField",
            }
        )
    )

    fields = forms.MultipleChoiceField(label=_("Fields to check"), choices=Keyword.FIELD_CHOICES)