Skip to content

Commit

Permalink
add empty template check when no external url is set
Browse files Browse the repository at this point in the history
  • Loading branch information
rm03 committed Sep 24, 2023
1 parent 665950c commit 8f3d74e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/clubs/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2644,6 +2644,12 @@ def get_image_url(self, obj):
def validate(self, data):
acceptance_template = data.get("acceptance_email", "")
rejection_template = data.get("rejection_email", "")
external_url = self.context["request"].data.get("external_url")

if not external_url and not (acceptance_template and rejection_template):
raise serializers.ValidationError(
"Your application email templates cannot be empty!"
)

if not ClubApplication.validate_template(
acceptance_template
Expand Down

0 comments on commit 8f3d74e

Please sign in to comment.