So I am creating this website using django framework: gegeneo.pythonanywhere.com
I have two tables Patient and Diagnosis:
Patient:
class Patient(models.Model):
PatientName = models.CharField(max_length = 120);
PatientBirthDate = models.DateField();
PatientInitialWeight = models.PositiveIntegerField();
PatientBloodGroup = models.CharField(max_length = 4);
Patient_Booking_Date = models.DateTimeField(auto_now = False, auto_now_add = True);
def __str__(self):
return self.PatientName;
Diagnosis:
class Diagnosis(models.Model):
PatientVisitDate = models.DateTimeField(auto_now = False, auto_now_add = True);
PatientWeight = models.PositiveIntegerField();
PatientDiagnosis = models.TextField();
patient = models.ForeignKey(Patient, on_delete = models.CASCADE);
def __str__(self):
return "Diagnosis of: " + self.patient.PatientName;
If you take a look at the website at : Here
You will see a list of the patients, and when one is clicked it will redirect to his page, I am now facing problems adding Diagnosis view to each patient, I want to make a form with Diagnosis fields and create a view for it, then make the diagnosis of each patient only appear on his HTML page.
So, how can I do that?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire