Am I correct in understanding that "from django.views.generic import list_detail" has been deprecated and/or removed from Django?
If so, what is the appropriate successor?
Thanks,
--
@Gareth, thanks.
I have a followup question to ask: how do you use a ListView to replace a list_detail.object_detail?
The present code, which has been changed only in the import, is:
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 does not seem to suggest a single inline replacement for:
url(r"^(?P<object_id>\d+)/$", list_detail.object_detail,
announcement_detail_info, name="announcement_detail"),
If anything, it suggests an additional model be added, and that model be built on.
Is there a quick, inline replacement for the list_detail.object_detail call, or does it take more uprooting?
Thanks,
django.views.generic.list_detail
was deprecated in Django 1.3:
From Django 1.3, function-based generic views have been deprecated in favor of a class-based approach.
Use django.views.generic.list.ListView
instead.
After importing django.views.generic.list.ListView
You just need to change list_detail.object_detail
to ListView.as_view()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With