Hello everyone hope you all doing well.
I need little guidance/help
I want to get all slots between the start time and end time in slots.Each slot will be of 15 minutes.How can we send all slots to the database
class Schedule(models.Model):
doctor=models.ForeignKey(Doctor, on_delete=models.CASCADE)
DAYS=(('Mon','Monday'),
('Tue','Tuesday'),
('Wed','Wednesday'),
('Thu','Thursday'),
('Fri','Friday'),
('Sat','Saturday'),
('Sun','Sunday'),
)
days=models.CharField(choices=DAYS,max_length=20,null=True,blank=True)
start_time=models.TimeField()
end_time=models.TimeField()
slot_time=models.CharField(max_length=50,default='15')
slots=models.CharField(max_length=5000,blank=True,null=True)
def __str__(self):
return str(self.doctor)
Thanks buddy,but I have done this,I want to send this to the database through postman,
- ashutoshmishra333 4 years, 6 months ago@Ashutosh, I would suggest to raise new ticket for any new requirement questions. So that it would be easy for developers to help you at the earliest. If the current ticket issue resolved then kindly close the ticket.
- VengatI have pretty much shared the steps to use to insert into database. When you say its not working then share me your code you have developed( may be share your github or update your code in ticket). And also lets focus to do the insert using Django shell then may be we can work on Postman.
- sunil 4 years, 6 months agoAs we are not getting any update on this ticket for a while, We are closing this ticket.
- Vengat
Found this stuff somewhere in forum, but i think this should help you.
You can create a generator something like to pass the start and end time and get the time slot and store it in DB
And if you pass the start and end time like below,
After you get the time slot from the above generator , you can store the same in timeslot field in your model.