diff --git a/usaon_vta_survey/forms.py b/usaon_vta_survey/forms.py
index 528d2e0b..a76a19ca 100644
--- a/usaon_vta_survey/forms.py
+++ b/usaon_vta_survey/forms.py
@@ -56,9 +56,8 @@ def conv_String(self, field_args, **extra):
FORMS_BY_MODEL: dict[BaseModel, Form] = {
User: model_form(
User,
- only=['orcid', 'biography', 'affiliation', 'role_id'],
- # Allows foreign key to be included in form.
- exclude_fk=False,
+ only=['orcid', 'biography', 'affiliation', 'role'],
+ field_args={'role': {'get_label': 'id'}},
),
Survey: model_form(Survey, only=['title', 'notes']),
# Response entities ("nodes" from Sankey diagram perspective)
@@ -87,8 +86,6 @@ def conv_String(self, field_args, **extra):
ResponseSocietalBenefitArea: model_form(
ResponseSocietalBenefitArea,
only=['societal_benefit_area'],
- exclude_fk=False,
- # field_args={'get_label': 'id' },
field_args={'societal_benefit_area': {'get_label': 'id'}},
),
# Response relationships ("edges" from Sankey diagram perspective)
diff --git a/usaon_vta_survey/models/tables.py b/usaon_vta_survey/models/tables.py
index cea1bca7..fa913a86 100644
--- a/usaon_vta_survey/models/tables.py
+++ b/usaon_vta_survey/models/tables.py
@@ -94,6 +94,7 @@ class User(BaseModel, UserMixin):
String,
nullable=True,
)
+ role = relationship('Role')
class Survey(BaseModel):
diff --git a/usaon_vta_survey/templates/macros/forms/user_profile.j2 b/usaon_vta_survey/templates/macros/forms/user_profile.j2
index bae3cc18..b1256ee1 100644
--- a/usaon_vta_survey/templates/macros/forms/user_profile.j2
+++ b/usaon_vta_survey/templates/macros/forms/user_profile.j2
@@ -31,10 +31,10 @@
{% endif %}
- {{form.role_id.label}} {{form.role_id(size=50)}}
- {% if form.role_id.errors %}
+ {{form.role.label}} {{form.role}}
+ {% if form.role.errors %}