hi all,
I have a views.py
...
def update_patient_view(request,pk):
patient=models.Patient.objects.get(id=pk)
user=models.User.objects.get(id=patient.user_id)
notes=models.PatientsNotes.objects.all().filter(patient_id=patient.get_patient_id)
visite=models.Visita.objects.all().filter(patient_id=patient.get_patient_id)
userForm=forms.PatientUserForm(instance=user)
patientForm=forms.PatientForm(instance=patient)
mydict={'userForm':userForm,'patientForm':patientForm,'notes':notes,'visite':visite,'patientID':pk}
return render(request,'hospital/admin2patient/admin_update_patient.html',context=mydict)
def add_patient_note_view(request,pk):
...
if request.method=='POST':
patientNotesForm=forms.PatientNotesForm(request.POST,instance=patientNotes)
if patientNotesForm.is_valid():
...
mydictReturn={'userForm':userForm,'patientForm':patientForm,'patientID':pk}
return render(request,'hospital/admin2patient/admin_update_patient.html',context=mydictReturn)
return render(request,'hospital/admin2patient/admin_add_patient_note.html',context=mydict)
navigating the application I obtain the following tree:
1)start from page http://127.0.0.1:8000/update-patient/1
ā
2)pushing button on html page (<a href="{% url 'add-patient-note' patientID %}">
)
I go on page http://127.0.0.1:8000/add-patient-note/1
ā
3)with submit form if if patientNotesForm.is_valid():
is valid the django show me the html page of update-patient
but with the url in the url bar equal to http://127.0.0.1:8000/add-patient-note/1
while I want reload http://127.0.0.1:8000/update-patient/1
reloading alla data defined in update_patient_view(request,pk):
I can not understand why the return render not works
many thanks in advance