As a part of a task, I created an "apartment listings" website. I managed to get that done, but now I need to make a "reservation system" for it.
The basic idea is that a logged in user can select an apartment from the listed apartments, pick a "start_date" and an "end_date" (if the apartment already isn't booked ) and book the apartment.
Im a total Django newbie, and need some pointers in order to start somewhere with this task.
I have an Apartment model which contains all of the Apartments info that I use to print everything out with the template.
I'm using the provided django user models to register / log-in.
What kind of model do I need for the reservation, and how could I connect everything ? I tried making a reservation model, but I got no idea where to go next.
I'm not asking for you to solve this for me, I'm asking for someone to explain (if possibile in detal) to me how could I go on about achieving this on my own.
this is my apartment model:
class Apartment(models.Model):
title = models.CharField(max_length=200)
address = models.CharField(max_length=200)
city = models.CharField(max_length=100)
state = models.CharField(max_length=100)
zipcode = models.CharField(max_length=20)
description = models.TextField(blank=True)
price = models.IntegerField()
bedrooms = models.IntegerField()
bathrooms = models.DecimalField(max_digits=2, decimal_places=1)
garage = models.IntegerField(default=0)
size = models.IntegerField()
photo_main = models.ImageField(upload_to='photos/%Y/%m/%d/')
photo_1 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
photo_2 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
photo_3 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
photo_4 = models.ImageField(upload_to='photos/%Y/%m/%d/', blank=True)
in_rent = models.BooleanField(default=False)
list_date = models.DateTimeField(default=datetime.now, blank=True)
def __str__(self):
return self.title
Thank you so much !