我对django很新,所以这可能是一个noob问题。 我想重用django admin的更改列表视图。我已经创建了一个管理模型,并希望为更改列表模板提供这些对象的列表。在我看来,我有:Django错误:'QueryDict'对象没有属性'_meta'
def placements(request):
partner_id = request.session.get('partner_id', 0)
self = PlacementAdmin(request.GET, Placement.objects.filter(partner=partner_id))
return render_to_response('publisher/placement/change_list.html', {'cl': self})
我得到这个错误,当我试着打从浏览器这个功能: “的QueryDict”对象有没有属性“_meta” 谁能告诉我是什么错误或提供一个更简单的方法来完成这种情况,以防我完全错误的轨道上。
继承人的完整跟踪:
Request Method: GET
Request URL: http://localhost:8080/publisher/
Django Version: 1.3 beta 1
Exception Type: AttributeError
Exception Value:
'QueryDict' object has no attribute '_meta'
Exception Location: /Users/imran/django_env/lib/python2.6/site-packages/django/contrib/admin/options.py in __init__, line 278
Python Executable: /Users/imran/django_env/bin/python
Python Version: 2.6.1
Python Path:
['.',
'.',
'/Users/imran/Workspaces/publisher/django/pub_admin',
'/Users/imran/django_env/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg',
'/Users/imran/django_env/lib/python2.6/site-packages/pip-0.8.1-py2.6.egg',
'/Users/imran/django_env/lib/python26.zip',
'/Users/imran/django_env/lib/python2.6',
'/Users/imran/django_env/lib/python2.6/plat-darwin',
'/Users/imran/django_env/lib/python2.6/plat-mac',
'/Users/imran/django_env/lib/python2.6/plat-mac/lib-scriptpackages',
'/Users/imran/django_env/Extras/lib/python',
'/Users/imran/django_env/lib/python2.6/lib-tk',
'/Users/imran/django_env/lib/python2.6/lib-old',
'/Users/imran/django_env/lib/python2.6/lib-dynload',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
'/Users/imran/django_env/lib/python2.6/site-packages']
感谢您的回答。我将看看ModelAdmin.changelist_view()。但我真的很喜欢管理应用程序中出现的内嵌编辑,排序和分页。如果我可以在我的应用程序中获得相同的视图而无需从头开始完成,那将非常棒。 – Imran 2011-02-08 03:17:05