2012-09-07 197 views
2

在HTSQL中,你可以查询一个manytomany关系吗?htsql django和manytomany的关系

在我的Django项目中(应用程序名称是config)我有一个Chapter,与FileName有ManyToMany关系。 当我查看实际的sqlite3数据库时,我看到表config_chapter_filenames(当然,所有的django管理员都按预期工作)。但是,当我打开HTSQL shell会话,表中未列出:

htsql-ctl shell -E tweak.django sqlite:/mydb.sqlite -E tweak.meta 
/meta(/table) 

它列出的表我的每个模型的,但不是多对多的关系。

我还没有能够找出将列出每章的文件名的查询。我猜测,如果HTSQL没有看到我可以解释问题的许多关系。

任何想法?

在htsql壳我看到型号:

config_chapter       
config_chapter_filenames 

这里是我的模型:

class Chapter(models.Model): 
    book = models.ManyToManyField(Book, through='ChapterMembership') 
    parent = models.ForeignKey(Book, related_name = '+') 
    filenames = models.ManyToManyField(FileName) 

我的网址我想的是:

http://machinename/htsql/config_chapter{name,filenames} 

我得到这个错误:

bind error: unrecognized attribute 'filenames' in scope of 'config_chapter': 
    /config_chapter{name,filenames} 
        ^^^^^^^^^ 

否则,我可以查询并获取章节和父节点的名称,但仍然不是文件名。我对introspect.py进行了更改,停止了我的apache服务器并重新启动。 还有什么我失踪?

还有一两件事,在htsql壳:

describe config_chapter 
Slots for `config_chapter` are: 
    id      integer 
    parent_id    integer 
    name      string 
    title     string 
    parent     SINGULAR(config_book) 
    config_chapter_filenames PLURAL(config_chapter_filenames) 

回答