Django管理网站与mongodb [英] Django admin site with mongodb

查看:159
本文介绍了Django管理网站与mongodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 django-mongodb 在mongodb中使用django。我可以设置django管理员网站(通过疑难解答页面修复),现在当我使用管理网站时,我可以查看所有的顶级字段,但是(有点像预期),嵌入的对象和列表不能被查看,它们只显示为 print 将显示他们,例如列表对象。

I am using django with mongodb through django-mongodb. I was able to set up the django admin site (through the fixes on the troubleshooting page), now when I use the admin site I am able to view all of the top-level fields, but (somewhat as expected) the embedded objects and lists are not able to be viewed, they just show up as a print would show them, "List Object" for example.

有没有办法使用管理界面查看子模型等。 ..?

Is there any way to use the admin interface to view the sub-models etc...?

如果没有方便的第三方方式,我该如何自己支持这种行为?

If there is no convenient third-party way, how would I go about supporting this behavior myself?

如果没有简单的方法来支持这个,那么有没有一个phpmyadmin类型的东西,我可以和django-mongodb一起使用(这可能只是位于mongodb之上的东西,不一定使用python / django)?

If there is no simple way to support this myself, is there a phpmyadmin type of thing for mongo that I can use in conjunction with django-mongodb (This could just be something that sits on top of mongodb not necessarily using python/django)?

*注意:我一直在使用视图这个词来参考我与模型的交互,我的冷杉第一个偏好是能够查看而不是编辑,但是如果有编辑功能,那可能会更好,这取决于修改的复杂程度。

*Note: I have been using the word 'view' in reference to my interaction with the model, my first preference is to be able to view and not edit, however if there is editing capability out there, that might be better, depending on how complex the modifications will be.

推荐答案

最近我一直在做同一个项目。管理员网站真的不知道如何表示mongodb文档中存在的非关系样式元素,因此您必须定义自定义字段/小部件。请参阅文档的这一部分,介绍如何扩展ModelAdmin以指定覆盖。
https://docs.djangoproject.com/ en / 1.3 / ref / contrib / admin /#modeladmin-objects

I have actually been doing the same project lately. The admin site doesnt really know how to represent the non-relational style elements that are present in a mongodb document, so you would have to define custom field/widgets. Refer to this part of the documentation which explains how to extend your ModelAdmin to specify overrides. https://docs.djangoproject.com/en/1.3/ref/contrib/admin/#modeladmin-objects

对于列表类型,django无法知道什么类型的值列表包含和如何表示它们。

For list types for instance, django has no way to know what type of values the list contains and how to represent them.

对于一个可视化的mongodb管理器,不知道你在操作系统,但是在OSX上,我喜欢这个: http://mongohub.todayclose.com/

As for a visual mongodb manager, not sure what OS you are on, but Im on OSX and I love this one: http://mongohub.todayclose.com/

否则,这里列出其他管理选项: http://www.mongodb.org/display/DOCS/Admin+UIs

Otherwise, here is a list of other management options: http://www.mongodb.org/display/DOCS/Admin+UIs

选择一个操作系统本机或基于Web的。

Take your pick for either an OS native or web based.

这篇关于Django管理网站与mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆