Django:对查询使用.distinct()会导致无效的DB查询

Django:对查询使用.distinct()会导致无效的DB查询,django,google-app-engine,django-models,Django,Google App Engine,Django Models,我正在尝试获取提交列表中不同商店名称的列表 我的非常简单的Django模型: 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_name = models.CharFie

我正在尝试获取提交列表中不同商店名称的列表

我的非常简单的Django模型:

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_name = models.CharField(max_length=200)  
如果我这样做:
stores=Submission.objects.values\u list('store\u name',flat=True)

那么打印结果很好:
[u'amazon.com',u'amazon.com',u'amazon.com',u'buy.com']

但是-如果我将.distinct()添加到查询中,则得到此查询不受数据库支持。

你知道为什么会这样吗?我一直在玩弄使用价值观,而不是没有运气的价值观列表


(最新django发行版,Python 2.6,OS X,Google App Engine)

Google Appengine数据存储API不支持
独特的
功能。这就是你所犯的错误,所以你不能这么做

您所能做的就是在获取以下结果后过滤非唯一问题:

stores = Submission.objects.values_list('store_name', flat=True)
unique_stores = []
for store in stores:
    if store not in unique_stores:
        unique_stores.append(store)

为了减轻这个问题,您可以运行
打印存储。查询
并在此处发布原始sql输出!从app_submission中选择DISTINCT app_submission.store_name看起来GAE现在确实支持DISTINCT