Skip to content

fix: merge static and dynamic extended profile fields - #93

Open
johanseto wants to merge 5 commits into
open-release/verawood.nelpfrom
jlc/compatible-static-dynamic-extension-fields
Open

johanseto wants to merge 5 commits into
open-release/verawood.nelpfrom
jlc/compatible-static-dynamic-extension-fields

Conversation

@johanseto

@johanseto johanseto commented Sep 17, 2026 •

Copy link
Copy Markdown

Description

Summary

Route extended profile fields to the correct storage in the account API instead of indiscriminately combining model-backed fields with UserProfile.meta.

extended_profile_fields acts as the allowlist for account API profile extensions. For each configured field, the API checks whether its name is a concrete field on the model configured by PROFILE_EXTENSION_FORM:

  • Model-backed fields are validated and written through the extension form to the model.
  • Configured fields that are not model-backed are written to UserProfile.meta.
  • Fields not listed in extended_profile_fields are ignored by the account API and are not included in extended-profile validation.

Reads use the same field classification: model-backed fields come from the extension model, and dynamic fields come from UserProfile.meta. If the user does not yet have an extension-model record, configured static fields can still be read from meta as a compatibility fallback. When a model record exists, its values are authoritative for model-backed fields.

Test

#Example Configuration

Settings:

PROFILE_EXTENSION_FORM = "custom_reg_form.forms.ExtraInfoForm"
REGISTRATION_EXTENSION_FORM_FIELDS_TPA_OVERRIDES = ["arabic_name", "national_id"]

Tenant config settings:

    "extended_profile_fields": [
        "hobby",
        "sport",
        "arabic_name",
        "national_id",
        "occupation",
        "movie"
    ],

Check the get of the data in the following endpoint.
Validate the static data - > extension profile form model
and dynamic data -> meta from profile data is retrieved.
http://local.openedx.io:8000/api/user/v1/accounts/admin

Before

2026-09-17_16-20

After

2026-09-17_16-32

Combine dynamic profile metadata with model-backed static fields when serializing user account data. Static fields take precedence when keys overlap.
@johanseto

Copy link
Copy Markdown
Author

Related with
nelc/frontend-app-account#16

Implemented the account API split:

extended_profile_fields is now the allowlist for extension fields. Unconfigured fields are ignored.
Configured fields that exist as concrete fields on the PROFILE_EXTENSION_FORM model are read and written through that model. Other configured fields use UserProfile.meta.
The extension form receives only submitted static fields, and its validation is limited to configured model-backed fields.
Updated the account API tests for the new storage behavior.
@johanseto
johanseto force-pushed the jlc/compatible-static-dynamic-extension-fields branch from 2542f67 to 92c2193 Compare September 29, 2026 23:02
@johanseto

Copy link
Copy Markdown
Author

extended_profile_fields control:

Screencast.from.30-09-26.09.48.29.webm

This branch has not been deployed

No deployments
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.

1 participant