我是否正确理解“从 django.views.generic 导入 list_detail”已被弃用和/或从 Django 中删除?
如果是这样,合适的继任者是什么?
谢谢,
--
@Gareth,谢谢。
我有一个后续问题要问:如何使用 ListView 替换 list_detail.object_detail?
目前的代码(仅在导入中更改)是:
from django.conf.urls.defaults import *
#from django.views.generic import list_detail
from django.views.generic.list import ListView
from announcements.models import Announcement
from announcements.views import *
announcement_detail_info = {
"queryset": Announcement.objects.all(),
}
urlpatterns = patterns("",
url(r"^(?P<object_id>\d+)/$", list_detail.object_detail,
announcement_detail_info, name="announcement_detail"),
url(r"^(?P<object_id>\d+)/hide/$", announcement_hide,
name="announcement_hide"),
url(r"^$", announcement_list, name="announcement_home"),
)
https://docs.djangoproject.com/en/dev/ref/class-based-views/generic-display/#listview似乎没有建议使用单个内联替换:
url(r"^(?P<object_id>\d+)/$", list_detail.object_detail,
announcement_detail_info, name="announcement_detail"),
如果有的话,它建议添加一个额外的模型,并建立该模型。
list_detail.object_detail 调用是否有快速的内联替换,还是需要更多的根除?
谢谢,