bgneal@214: """Models for the antispam application.""" bgneal@214: from django.db import models bgneal@214: from django.core.cache import cache bgneal@214: bgneal@214: from antispam import SPAM_PHRASE_KEY bgneal@214: bgneal@214: bgneal@214: class SpamPhrase(models.Model): bgneal@214: """A SpamPhrase is a string that is checked for in user input. User input bgneal@214: containing a SpamPhrase should be blocked and flagged. bgneal@214: """ bgneal@214: phrase = models.CharField(max_length=64) bgneal@214: bgneal@214: class Meta: bgneal@214: ordering = ('phrase', ) bgneal@214: bgneal@214: def __unicode__(self): bgneal@214: return self.phrase bgneal@214: bgneal@214: def save(self, *args, **kwargs): bgneal@214: cache.delete(SPAM_PHRASE_KEY) bgneal@214: super(SpamPhrase, self).save(*args, **kwargs)