This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import textwrap | |
from django.core.exceptions import ValidationError | |
from profanity_check import predict | |
def check_profanity(value: str): | |
"""Profanity check (Programmed by a 3rd party lib)""" | |
if predict(textwrap.wrap(value)): | |
raise ValidationError( | |
_( |