diff --git a/AUTHORS b/AUTHORS index 3aaa3d57ba2..a0159bccd02 100644 --- a/AUTHORS +++ b/AUTHORS @@ -67,6 +67,7 @@ answer newbie questions, and generally made Django that much better: Andrew Brehaut brut.alll@gmail.com Jonathan Buchanan + Trevor Caira Ricardo Javier Cárdenes Medina Antonio Cavedoni C8E diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py index a4559ad4958..46e92fe26ec 100644 --- a/django/views/generic/create_update.py +++ b/django/views/generic/create_update.py @@ -71,7 +71,7 @@ def create_object(request, model, template_name=None, return HttpResponse(t.render(c)) def update_object(request, model, object_id=None, slug=None, - slug_field=None, template_name=None, template_loader=loader, + slug_field='slug', template_name=None, template_loader=loader, extra_context=None, post_save_redirect=None, login_required=False, follow=None, context_processors=None, template_object_name='object'): @@ -146,7 +146,7 @@ def update_object(request, model, object_id=None, slug=None, return response def delete_object(request, model, post_delete_redirect, - object_id=None, slug=None, slug_field=None, template_name=None, + object_id=None, slug=None, slug_field='slug', template_name=None, template_loader=loader, extra_context=None, login_required=False, context_processors=None, template_object_name='object'): """ diff --git a/django/views/generic/date_based.py b/django/views/generic/date_based.py index d13c0293be7..c0f219f280e 100644 --- a/django/views/generic/date_based.py +++ b/django/views/generic/date_based.py @@ -286,7 +286,7 @@ def archive_today(request, **kwargs): def object_detail(request, year, month, day, queryset, date_field, month_format='%b', day_format='%d', object_id=None, slug=None, - slug_field=None, template_name=None, template_name_field=None, + slug_field='slug', template_name=None, template_name_field=None, template_loader=loader, extra_context=None, context_processors=None, template_object_name='object', mimetype=None, allow_future=False): """ diff --git a/django/views/generic/list_detail.py b/django/views/generic/list_detail.py index 16d55202dae..f5616b9745e 100644 --- a/django/views/generic/list_detail.py +++ b/django/views/generic/list_detail.py @@ -87,7 +87,7 @@ def object_list(request, queryset, paginate_by=None, page=None, return HttpResponse(t.render(c), mimetype=mimetype) def object_detail(request, queryset, object_id=None, slug=None, - slug_field=None, template_name=None, template_name_field=None, + slug_field='slug', template_name=None, template_name_field=None, template_loader=loader, extra_context=None, context_processors=None, template_object_name='object', mimetype=None): diff --git a/docs/generic_views.txt b/docs/generic_views.txt index 2b80348903a..0601aead11c 100644 --- a/docs/generic_views.txt +++ b/docs/generic_views.txt @@ -40,7 +40,7 @@ simple weblog app that drives the blog on djangoproject.com:: } urlpatterns = patterns('django.views.generic.date_based', - (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[-\w]+)/$', 'object_detail', dict(info_dict, slug_field='slug')), + (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(?P[-\w]+)/$', 'object_detail', info_dict), (r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/$', 'archive_day', info_dict), (r'^(?P\d{4})/(?P[a-z]{3})/$', 'archive_month', info_dict), (r'^(?P\d{4})/$', 'archive_year', info_dict), @@ -603,7 +603,7 @@ future, the view will throw a 404 error by default, unless you set Otherwise, ``slug`` should be the slug of the given object, and ``slug_field`` should be the name of the slug field in the ``QuerySet``'s - model. + model. By default, ``slug_field`` is ``'slug'``. **Optional arguments:** @@ -804,7 +804,7 @@ A page representing an individual object. Otherwise, ``slug`` should be the slug of the given object, and ``slug_field`` should be the name of the slug field in the ``QuerySet``'s - model. + model. By default, ``slug_field`` is ``'slug'``. **Optional arguments:** @@ -948,7 +948,7 @@ object. This uses the automatic manipulators that come with Django models. Otherwise, ``slug`` should be the slug of the given object, and ``slug_field`` should be the name of the slug field in the ``QuerySet``'s - model. + model. By default, ``slug_field`` is ``'slug'``. **Optional arguments:** @@ -1033,7 +1033,7 @@ contain a form that POSTs to the same URL. Otherwise, ``slug`` should be the slug of the given object, and ``slug_field`` should be the name of the slug field in the ``QuerySet``'s - model. + model. By default, ``slug_field`` is ``'slug'``. * ``post_delete_redirect``: A URL to which the view will redirect after deleting the object.