开发者

Django/GAE: How to filter query set on foreignkey?

I have two very simple classes Submission and Store

class Submission(models.Model):  
    title = models.CharField(max_length=50, null=True, blank=True)  
    description = models.CharField(max_length=200, null= True, blank=True)  
    store = models.ForeignKey(Store)  

class Store(models.Model):   
    store_name = models.CharField(max_length=200)  
    store_url = mode开发者_运维问答ls.CharField(max_length=200)  

I'd like to look up all the Submissions for a particular Store, filtering by store_name.

In regular Django I can do something like

Submission.objects.filter(store__store_name__exact=_myStoreName_)  

However this appears to be invalid database query in Django with Google Appengine (using the djangoappengine package).

What can I do instead?

Thank you.


inner_query = Store.objects.filter(store_name='storename')
submissions = Submission.objects.filter(store__in=inner_query)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜