New to Django

51 views
Skip to first unread message

Kevin gallagher

unread,
Nov 2, 2022, 1:05:04 PM11/2/22
to Django users
Hi guys,
Im currently learning django and am doing a project for college. Im building an appointment website users can book a training session. These are my models:

class TimeSlot(models.Model):

    title = models.CharField(max_length=50)

    def __str__(self):
        return f'There is a slot at {self.title}'


class Booking(models.Model):

    user = models.ForeignKey(settings.AUTH_USER_MODEL,
                             on_delete=models.CASCADE)
    time_slot = models.ForeignKey(TimeSlot, on_delete=models.CASCADE)
    booking_date = models.DateField(("Date"), default=date.today)

    def __str__(self):
        return f'{self.user} has booked a session at {self.timeslot.title} on {self.booking_date}'

I have the title field set as available session times, 1-2pm, 3-4pm etc.
I want the user to select a date and then be able to see what time slots are still available to book but I'm kind of lost and confused. Any help would be much appreciated! 
 

Sebastian Jung

unread,
Nov 2, 2022, 3:59:36 PM11/2/22
to django...@googlegroups.com
Hello kevin,

There are several django booking apps like this https://github.com/bernii/django-reservations

I think its easier to change existing code to your requirements then begin from strech.

Good luck 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1c6c2ab1-f852-4503-81c5-d072cf2dbb02n%40googlegroups.com.

subin

unread,
Nov 3, 2022, 3:24:23 PM11/3/22
to django...@googlegroups.com
Thanks again for all your help.

subin

unread,
Nov 3, 2022, 3:28:08 PM11/3/22
to django...@googlegroups.com
Please let me know if that sounds okay.

Kevin gallagher

unread,
Nov 6, 2022, 5:46:13 AM11/6/22
to Django users
Thanks for the help! 
Reply all
Reply to author
Forward
0 new messages