Open lcsavb opened 8 months ago
I had to write a custom save() method.
def save(self, commit=True): patient = super().save(commit=False) issuer_list = self.cleaned_data.get('issuer') if commit: patient.save()
self.user.patients.add(patient) [patient.issuer.add(issuer) for issuer in issuer_list] return patient
It's needed a custom method anyway to associate the Patient to the logged user, YET the association with Issuer should be automatic.
It is working that way, but it shouldn' be necessary to explicitly write [patient.issuer.add(issuer) for issuer in issuer_list]
I had to write a custom save() method.
def save(self, commit=True): patient = super().save(commit=False) issuer_list = self.cleaned_data.get('issuer') if commit: patient.save()
The patient must be to the logged-in user and in its issuer list
It's needed a custom method anyway to associate the Patient to the logged user, YET the association with Issuer should be automatic.
It is working that way, but it shouldn' be necessary to explicitly write [patient.issuer.add(issuer) for issuer in issuer_list]