from django.db import models from django.core.validators import MinValueValidator class RoomType(models.Model): room_type = models.CharField(max_length=40) def __str__(self): return self.room_type class Room(models.Model): room_number = models.IntegerField( primary_key=True, validators=[ MinValueValidator(1) ] ) price = models.IntegerField( validators=[ MinValueValidator(1) ] ) room_type = models.ForeignKey(RoomType, on_delete=models.CASCADE) reserved = models.BooleanField() def __str__(self): return str(self.room_number)