Skip to content

Commit

Permalink
vincent nits
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleyzhang01 committed Apr 24, 2024
1 parent 3075101 commit ed29e4d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
1 change: 0 additions & 1 deletion backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ python-dateutil = "*"
selenium = "*"
webdriver-manager = "*"
pre-commit = "*"
profanity-check = "*"
alt-profanity-check = "*"

[requires]
Expand Down
10 changes: 1 addition & 9 deletions backend/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions backend/sublet/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,17 @@ class Meta:
]

def validate_title(self, value):
# Check for profanity in the title
if self.contains_profanity(value):
raise serializers.ValidationError("The title contains inappropriate language.")
return value

def validate_description(self, value):
# Check for profanity in the description
if self.contains_profanity(value):
raise serializers.ValidationError("The description contains inappropriate language.")
return value

def contains_profanity(self, text):
return predict([text])[0] == 1
return predict([text])[0]

def create(self, validated_data):
validated_data["subletter"] = self.context["request"].user
Expand Down

0 comments on commit ed29e4d

Please sign in to comment.