Skip to content

Populate Country table#5168

Merged
AlexVelezLl merged 1 commit intolearningequality:community-channelsfrom
Jakoma02:populate-country-table
Jul 11, 2025
Merged

Populate Country table#5168
AlexVelezLl merged 1 commit intolearningequality:community-channelsfrom
Jakoma02:populate-country-table

Conversation

@Jakoma02
Copy link
Contributor

Summary

This PR ensures that Country model instances are created with country codes and names from ISO 3166-1 upon running make migrate.

Detailed changes:

  • Added and frozen pycountry dependency for getting the list of countries
  • Kosovo was added to the countries known to pycountry to stay in sync with the country list in the frontend
  • A new CountryGenerator was created, used to generate country constants, and added to the list of constants
  • Comments were added to document that the backend and frontend lists must stay in sync

The changes were tested by running the make migrate command and checking that the countries table was populated in the database, particularly checking that Kosovo was present.

References

Resolves #5158

Reviewer guidance

Apart from code review, running the make migrate command and checking that the country table got populated should be sufficient.

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Jakoma02! Looks good to me!


def generate_list(self):
# Get constants from subclass' default_list (from le-utils pkg)
# Get constants from subclass' default_list (usually from le-utils pkg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clarification 😅

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Jakoma02! Merging

@AlexVelezLl AlexVelezLl merged commit 6894877 into learningequality:community-channels Jul 11, 2025
12 checks passed
@AlexVelezLl AlexVelezLl linked an issue Jul 17, 2025 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ESoCC: Populate the Country table

2 participants