I have two tables as follows in Django:
Table1:
- id
- name
- address
- state
- short_code
Table2:
- id
- table1_id
- p1, property (searchable field)
Relationship between Table1 and Table2: Table1(1) -> Table2(n) [ 1->n ]
Let's say I have a searchable property p1 in Table2. How to fetch all the rows from Table1 which is satisfying the following query parameters?
short_code(table1 field), state(table1 field), and property as p1(table2 field)
Remember, Table1 has 1:n relationship with Table2, so Table2 can have multiple rows satisfying foreign key relationship of field id from Table1.