[Fixed]-How To a autoselect Patient Name field when bed assign to patients in Django

1👍

You can give the view you are using to add a WardConfig record a get_initial method. This assumes you are passing a patient_id kwarg in the URL:

def get_initial(self):
    patient = get_object_or_404(Patient, pk=self.kwargs.get('patient_id'))
    return {
        'patient': patient,
    }

Leave a comment