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,
}
Source:stackexchange.com