HH/.mimocode/plans/1782056018571-stellar-garden.md

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 — Remove HospitalFieldMixin from both form classes, adjust __init__ to not pop request/user kwargs (since HospitalFieldMixin no 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)