[BB-2059] Remove deprecated city field from student features report


This PR updates the student features report to pull from UserProfile.meta['city'] if it is set, in favor over `UserProfile.city`.

There are two distinct ways to store a city for users in edx-platform: one directly in `UserProfile.city`, and another in `UserProfile.meta`.

`UserProfile.meta` is used by adding `"city"` to the `extended_profile_fields`. This is then available via the account settings editor. The `UserProfile.city` field is not used or available via the account settings page.

Conversely to use a City field in the registration form, the `REGISTRATION_EXTRA_FIELDS["city"]` must be configured, and then entries are stored in `UserProfile.city`, which can't later be edited from the account settings page since it's [not included in the field set](https://github.com/edx/edx-platform/blob/0db4fb0ffe8ef568a9cae2b1c5da92065bbdd5e6/openedx/core/djangoapps/user_api/accounts/settings_views.py#L112).

Since the `UserProfile.meta['city']` field is not set unless specifically configured, we choose this over the `UserProfile.city` field when generating the student features report.

*Dependencies*: None

*Testing instructions*:

1. Add `"extended_profile_fields":"city"` (to the SiteConfiguration)http://localhost:18000/admin/site_configuration/siteconfiguration/1/change/
2. Set `{"city": "Test City"}` in the `UserProfile.meta` field for a (test user)http://localhost:18000/admin/auth/user/5/change/.
3. Generate a report of student profiles with the "Download profile information as CSV" button in the instructor view for the [edX DemoX Course](http://localhost:18000/courses/course-v1:edX+DemoX+Demo_Course/instructor#view-data_download).
4. Check that the "city" field is filled in from the value set in step #2.


  • [ ] (@lgp171188)

  • [ ] edX reviewer[s] TBD


Natalia Berdnikov
January 15, 2021, 3:28 PM


Natalia Berdnikov
January 15, 2021, 3:28 PM

Blocked by author’s budget temporarily.

Your pinned fields
Click on the next to a field label to start pinning.


Braden MacDonald


Open Source Pull Request Bot


Contributor Name

Josh McLaughlin




Platform Map Area (Levels 1 & 2)

Learner Experiences - Identity & Account Tools

Github Lines Added


Github Lines Deleted