Hi All,
I have a question: how to use table A.column1 as parameter to query result from table B?
I have two tables :
1. UserStay
id candidatePoiIds selectedPoiId
1 101,102,103 100
2. POIs
id name address
100 starbuck 100 main st,
101 mcdonalds 101 main st,
i want to get all candiate POI's name and address when i fetch User stays, the following code does not work , i also tried Manager with raw SQL, but i dont' know how to pass the candidatePois to manager, can i get the string value of "candidatePois" in model ?
class UserStays(models.Model):
startTime = models.IntegerField('startTime', max_length=255)
candidatePois = models.CharField('CharField', max_length=255)
poiRes = POIS.objects.filter(id in F('candidatePois') )
// poiRes = POIS.objects.filter(id = 100 )
//print poiRes.name + poiRes.address
Thanks
Rock