I think you are trying to establish a many-to-many relationship between the models, that way it would be like this
poiRes = models.ManyToManyField(POIS) and the candidatePois is unnecessary in that case. On Tue, Oct 21, 2014 at 3:16 PM, zhang rock <xxzhang.r...@gmail.com> wrote: > 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 > > -- > 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 post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/722f80db-4069-4e30-a94a-c7d58a9c6c3d%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/722f80db-4069-4e30-a94a-c7d58a9c6c3d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei2hyGsgRNH2MGGjZ2J47LYLU%3Dc800_b2XTU0teHM_5aMw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.