Skip to content

Commit 5c7c236

Browse files
committed
has_grant var
1 parent 176657b commit 5c7c236

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

backend/notifications/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class EmailTemplate(TimeStampedModel):
162162
EmailTemplateIdentifier.visa_invitation_letter_download: [
163163
*BASE_PLACEHOLDERS,
164164
"invitation_letter_download_url",
165+
"has_grant",
165166
],
166167
}
167168

backend/visa/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ def grant_approved_type(self):
114114
def user_grant(self):
115115
return Grant.objects.for_conference(self.conference).of_user(self.user).first()
116116

117+
@property
118+
def has_grant(self):
119+
return self.user_grant is not None
120+
117121
@cached_property
118122
def role(self):
119123
user = self.user

backend/visa/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ def send_invitation_letter_via_email(*, invitation_letter_request_id: int):
257257
recipient_email=invitation_letter_request.email,
258258
placeholders={
259259
"invitation_letter_download_url": invitation_letter_download_url,
260+
"has_grant": invitation_letter_request.has_grant,
260261
},
261262
)
262263

backend/visa/tests/test_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_request_on_behalf_of_other():
2020
assert request.email == "[email protected]"
2121
assert request.user is None
2222
assert request.role == "Attendee"
23+
assert request.has_grant is False
2324

2425
# With matching user, it is found
2526
user = UserFactory(email="[email protected]")
@@ -47,6 +48,7 @@ def test_request_grant_info(approved_type):
4748
)
4849

4950
assert request.user_grant == grant
51+
assert request.has_grant is True
5052
assert request.has_accommodation_via_grant() == (
5153
approved_type
5254
in [

0 commit comments

Comments
 (0)