1.0 KiB
1.0 KiB
Fix: Hospital select not visible on /config/users/create/
Problem
The HospitalFieldMixin in apps/core/form_mixins.py:44 sets hospital_field.widget = forms.HiddenInput(), hiding the hospital field. This mixin is designed for forms where hospital is auto-set from user context, but for user creation we need a visible dropdown.
Fix
Remove HospitalFieldMixin from UserCreateForm and UserEditForm in apps/accounts/forms.py. Keep DepartmentFieldMixin for department filtering.
The forms already define hospital as a ModelChoiceField with a Select widget — removing the mixin will let it render normally.
Files to modify
apps/accounts/forms.py— RemoveHospitalFieldMixinfrom both form classes, adjust__init__to not poprequest/userkwargs (sinceHospitalFieldMixinno longer handles that)
Verification
- Navigate to
/config/users/create/— hospital dropdown should be visible - PX Admin sees all active hospitals
- Hospital Admin sees only their hospital (can pre-set it in the view)