Skip to content

Commit 8f9a178

Browse files
committed
Renamed travellingFrom to departureCountry for consistency with departureCity
1 parent f58f73c commit 8f9a178

File tree

19 files changed

+360
-93
lines changed

19 files changed

+360
-93
lines changed

backend/api/grants/mutations.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class _GrantErrors:
4444
need_accommodation: list[str] = strawberry.field(default_factory=list)
4545
why: list[str] = strawberry.field(default_factory=list)
4646
notes: list[str] = strawberry.field(default_factory=list)
47-
travelling_from: list[str] = strawberry.field(default_factory=list)
47+
departure_country: list[str] = strawberry.field(default_factory=list)
4848
nationality: list[str] = strawberry.field(default_factory=list)
4949
departure_city: list[str] = strawberry.field(default_factory=list)
5050
non_field_errors: list[str] = strawberry.field(default_factory=list)
@@ -72,15 +72,14 @@ def validate(self, conference: Conference, user: User) -> GrantErrors:
7272
max_length_fields = {
7373
"full_name": 300,
7474
"name": 300,
75-
"travelling_from": 100,
75+
"departure_country": 100,
7676
"nationality": 100,
7777
"departure_city": 100,
7878
}
7979
for field, max_length in max_length_fields.items():
8080
value = getattr(self, field, "")
8181

8282
if value and len(value) > max_length:
83-
print(field)
8483
errors.add_error(
8584
field,
8685
f"{field}: Cannot be more than {max_length} chars",
@@ -120,7 +119,7 @@ class SendGrantInput(BaseGrantInput):
120119
need_accommodation: bool
121120
why: str
122121
notes: str
123-
travelling_from: str | None = None
122+
departure_country: str | None = None
124123
nationality: str
125124
departure_city: str | None = None
126125

@@ -159,7 +158,7 @@ class UpdateGrantInput(BaseGrantInput):
159158
need_accommodation: bool
160159
why: str
161160
notes: str
162-
travelling_from: str | None = None
161+
departure_country: str | None = None
163162
nationality: str
164163
departure_city: str | None = None
165164

@@ -239,7 +238,7 @@ def send_grant(self, info: Info, input: SendGrantInput) -> SendGrantResult:
239238
"need_accommodation": input.need_accommodation,
240239
"why": input.why,
241240
"notes": input.notes,
242-
"travelling_from": input.travelling_from,
241+
"departure_country": input.departure_country,
243242
"nationality": input.nationality,
244243
"departure_city": input.departure_city,
245244
}

backend/api/grants/tests/test_send_grant.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _send_grant(client, conference, conference_code=None, **kwargs):
3838
validationNeedAccommodation: needAccommodation
3939
validationWhy: why
4040
validationNotes: notes
41-
validationTravellingFrom: travellingFrom
41+
validationDepartureCountry: departureCountry
4242
validationNationality: nationality
4343
validationDepartureCity: departureCity
4444
validationParticipantBio: participantBio
@@ -71,7 +71,7 @@ def _send_grant(client, conference, conference_code=None, **kwargs):
7171
"needAccommodation": grant.need_accommodation,
7272
"why": grant.why,
7373
"notes": grant.notes,
74-
"travellingFrom": grant.travelling_from,
74+
"departureCountry": grant.departure_country,
7575
"nationality": grant.nationality,
7676
"departureCity": grant.departure_city,
7777
"participantBio": "my bio",
@@ -218,7 +218,7 @@ def test_cannot_send_grant_outside_allowed_values(
218218
graphql_client,
219219
conference,
220220
name="Marcotte" * 50,
221-
travellingFrom="Very long location" * 50,
221+
departureCountry="Very long location" * 50,
222222
nationality="Freedonia" * 50,
223223
departureCity="Emerald City " * 50,
224224
)
@@ -227,8 +227,8 @@ def test_cannot_send_grant_outside_allowed_values(
227227
assert response["data"]["sendGrant"]["errors"]["validationName"] == [
228228
"name: Cannot be more than 300 chars"
229229
]
230-
assert response["data"]["sendGrant"]["errors"]["validationTravellingFrom"] == [
231-
"travelling_from: Cannot be more than 100 chars"
230+
assert response["data"]["sendGrant"]["errors"]["validationDepartureCountry"] == [
231+
"departure_country: Cannot be more than 100 chars"
232232
]
233233
assert response["data"]["sendGrant"]["errors"]["validationNationality"] == [
234234
"nationality: Cannot be more than 100 chars"

backend/api/grants/tests/test_update_grant.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _update_grant(graphql_client, grant, **kwargs):
3434
validationNeedAccommodation: needAccommodation
3535
validationWhy: why
3636
validationNotes: notes
37-
validationTravellingFrom: travellingFrom
37+
validationDepartureCountry: departureCountry
3838
validationNationality: nationality
3939
validationDepartureCity: departureCity
4040
validationParticipantBio: participantBio
@@ -67,7 +67,7 @@ def _update_grant(graphql_client, grant, **kwargs):
6767
"needAccommodation": grant.need_accommodation,
6868
"why": grant.why,
6969
"notes": grant.notes,
70-
"travellingFrom": grant.travelling_from,
70+
"departureCountry": grant.departure_country,
7171
"nationality": grant.nationality,
7272
"departureCity": grant.departure_city,
7373
"participantBio": "bio",
@@ -113,7 +113,7 @@ def test_update_grant(graphql_client, user):
113113
needAccommodation=True,
114114
why="why not",
115115
notes="🧸",
116-
travellingFrom="GB",
116+
departureCountry="GB",
117117
nationality="Italian",
118118
departureCity="Rome",
119119
participantFacebookUrl="http://facebook.com/pythonpizza",
@@ -211,7 +211,7 @@ def test_cannot_update_submission_with_lang_outside_allowed_values(
211211
graphql_client,
212212
grant=grant,
213213
name="Marcotte" * 50,
214-
travellingFrom="Very long location" * 50,
214+
departureCountry="Very long location" * 50,
215215
nationality="Freedonia" * 50,
216216
departureCity="Emerald City " * 50,
217217
)
@@ -220,8 +220,8 @@ def test_cannot_update_submission_with_lang_outside_allowed_values(
220220
assert response["data"]["updateGrant"]["errors"]["validationName"] == [
221221
"name: Cannot be more than 300 chars"
222222
]
223-
assert response["data"]["updateGrant"]["errors"]["validationTravellingFrom"] == [
224-
"travelling_from: Cannot be more than 100 chars"
223+
assert response["data"]["updateGrant"]["errors"]["validationDepartureCountry"] == [
224+
"departure_country: Cannot be more than 100 chars"
225225
]
226226
assert response["data"]["updateGrant"]["errors"]["validationNationality"] == [
227227
"nationality: Cannot be more than 100 chars"

backend/api/grants/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Grant:
3131
need_accommodation: bool
3232
why: str
3333
notes: str
34-
travelling_from: Optional[str]
34+
departure_country: Optional[str]
3535
nationality: Optional[str]
3636
departure_city: Optional[str]
3737
applicant_reply_deadline: Optional[datetime]
@@ -55,7 +55,7 @@ def from_model(cls, grant: GrantModel) -> Grant:
5555
need_accommodation=grant.need_accommodation,
5656
why=grant.why,
5757
notes=grant.notes,
58-
travelling_from=grant.travelling_from,
58+
departure_country=grant.departure_country,
5959
nationality=grant.nationality,
6060
departure_city=grant.departure_city,
6161
applicant_reply_deadline=grant.applicant_reply_deadline,

backend/grants/admin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"needs_funds_for_travel",
4343
"why",
4444
"notes",
45-
"travelling_from",
45+
"departure_country",
4646
"conference__code",
4747
"created",
4848
)
@@ -375,7 +375,7 @@ class Meta:
375375
"needs_funds_for_travel",
376376
"why",
377377
"notes",
378-
"travelling_from",
378+
"departure_country",
379379
"country_type",
380380
"applicant_reply_sent_at",
381381
"applicant_reply_deadline",
@@ -450,13 +450,13 @@ class GrantAdmin(ExportMixin, ConferencePermissionMixin, admin.ModelAdmin):
450450
"need_accommodation",
451451
IsProposedSpeakerFilter,
452452
IsConfirmedSpeakerFilter,
453-
("travelling_from", CountryFilter),
453+
("departure_country", CountryFilter),
454454
"user__gender",
455455
)
456456
search_fields = (
457457
"email",
458458
"full_name",
459-
"travelling_from",
459+
"departure_country",
460460
"been_to_other_events",
461461
"why",
462462
"notes",
@@ -514,7 +514,7 @@ class GrantAdmin(ExportMixin, ConferencePermissionMixin, admin.ModelAdmin):
514514
"needs_funds_for_travel",
515515
"need_visa",
516516
"need_accommodation",
517-
"travelling_from",
517+
"departure_country",
518518
"why",
519519
"python_usage",
520520
"been_to_other_events",
@@ -540,8 +540,8 @@ def user_display_name(self, obj):
540540
description="C",
541541
)
542542
def country(self, obj):
543-
if obj.travelling_from:
544-
country = countries.get(code=obj.travelling_from)
543+
if obj.departure_country:
544+
country = countries.get(code=obj.departure_country)
545545
if country:
546546
return country.emoji
547547

backend/grants/migrations/0022_grant_departure_city_grant_nationality.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)