fix: profanity detector
This commit is contained in:
parent
0dc6a34832
commit
e97e204a5e
3 changed files with 14 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
import json
|
||||
import random
|
||||
|
||||
import profanity.templatetags.profanity
|
||||
from django.db import IntegrityError
|
||||
from django.http import HttpResponse, Http404
|
||||
|
||||
|
@ -15,6 +16,14 @@ def add(request, origin, name, color, shirt, hat, decor):
|
|||
hat = int(hat.strip())
|
||||
decor = int(decor.strip())
|
||||
|
||||
if profanity.templatetags.profanity.is_profane(name):
|
||||
print("profanity detected")
|
||||
return HttpResponse("profanity detected")
|
||||
|
||||
if profanity.templatetags.profanity.is_profane(origin):
|
||||
print("profanity detected")
|
||||
return HttpResponse("profanity detected")
|
||||
|
||||
try:
|
||||
dragon = Dragon.objects.create(origin=origin, name=name, color=color, shirt=shirt, hat=hat, decor=decor)
|
||||
print(f'Received dragon ({dragon})')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue