I am trying to create doctor appointment booking system in Django.
I have two models: Doctor and Patient, with personal details. I am looking for the way how to connect both, using specific time-slots/date for appointments. Doctors may be available in a different time-slots or days.
For example:
Doctor A is available from Monday to Friday, 8:00 - 16:00. I need to book Patient A for 30-minutes appointment at 10:00 and Patient B at 10:30.
class Doctor(models.Model):
first_name = models.CharField(max_length=30, verbose_name="First name")
second_name = models.CharField(max_length=30, verbose_name="Second name")
doctor_type = models.ForeignKey(Specialisation, on_delete=models.CASCADE, verbose_name='Specialisation')
doctor_status = models.CharField(max_length=30, choices=status_choices, default='Non-Active', verbose_name='Doctor status')
image = models.ImageField(upload_to='photos', blank=True, verbose_name='Photo')
def __str__(self):
return self.second_name + " " + self.first_name
class Patient(models.Model):
first_name = models.CharField(max_length=30, verbose_name="First name")
second_name = models.CharField(max_length=30, verbose_name="Second name")
contact_details = models.CharField(max_length=30, verbose_name="Contact details")
postcode = models.CharField(max_length=3, verbose_name="PostCode")
patient_status = models.CharField(max_length=30, choices=status_choices, verbose_name='Patient status')
def __str__(self):
return self.second_name + " " + self.first_name
Thanks!