Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cannot resolve keyword 'PatientInfoID' into field

I ran into a problem while running my project, I encountered this error

Cannot resolve keyword ‘PatientInfoID’ into field. Choices are: Content, Dept, Doc, Doc_InfoID, Doc_InfoID_id, Patient_InfoID, Patient_InfoID_id, email, id, name, patienthistory, ref, status

While this is my views.py

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

def profile(request):
user = request.user
patient = Patient.objects.filter(user = user)
appointment = Appointment.objects.filter(PatientInfoID = patient)
patienthis = PatientHistory.objects.filter(Appnt_InfoID=appointment)

return render(request, 'appointment.html', {'histories' : patienthis})

this is my urls.py

   path('profile', views.profile, name='profile')

and this is my models.py

class Appointment(models.Model):
Patient_InfoID = models.ForeignKey(Patient, on_delete=models.CASCADE, null=True)
Doc_InfoID = models.ForeignKey(Doctor, on_delete=models.CASCADE, null=True)
name = models.CharField(max_length=100)
email = models.CharField(max_length=100)
phone = models.IntegerField
Adate = models.DateField
Dept = models.CharField(max_length=100)
Doc = models.CharField(max_length=100)
Content = models.CharField(max_length=500)
status = models.CharField(max_length=10, choices=COLOR_CHOICES, default='new')
ref = models.CharField(max_length=100)

>Solution :

Shouldn’t you be using Patient_InfoID instead of PatientInfoID in your views.py?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading