Hello group members,

How can I get result containing any information from both 3 models

eg.
 Customer|contact          | room number|room price| business|
-------------
-------------------------------------------------------------------
John Doe |+1 989898989|12                 | 1000        |restaurant


class Room(models.Model):
room_id = models.AutoField(primary_key=True)
room_number = models.CharField(max_length = 200)
room_square_meters = models.IntegerField()
room_price = models.IntegerField()

def __int__(self):
return  self.room_number


class Customer(models.Model):
    customer_id = models.AutoField(primary_key=True)
    national_id = models.CharField(max_length=200)
    first_name = models.CharField(max_length=200)
    last_name = models.CharField(max_length=200)
    contact_number = models.CharField(max_length=200)
    customer_status = models.BooleanField(default=True)

    def __str__(self):
        return self.first_name+' '+self.last_name

class CustomerRooms(models.Model):
    room = models.ForeignKey(Room,on_delete=models.CASCADE)
    customer  = models.ForeignKey(Customer,on_delete=models.CASCADE)
    business = models.CharField(max_length = 200)

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABnE44ym3kYFaKV0xRhHAKRWP9yrG8F%3DX_oPKWPOOLt_FpWtAQ%40mail.gmail.com.

Reply via email to