summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-08-12 12:59:41 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-08-12 12:59:41 +0000
commit56e28b4e8fd923b8e84ceaaf8d0560175ec97c46 (patch)
tree03c561c9b64b87517c38dc154f0a068d4eff3829
parentf6e86c42860b8c690ea2d0f43c8827845ba65dfd (diff)
Fixed #5085 -- In generic views, set the default name for the slug field to 'slug'. Thanks, Trevor Caira.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5877 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--AUTHORS1
-rw-r--r--django/views/generic/create_update.py4
-rw-r--r--django/views/generic/date_based.py2
-rw-r--r--django/views/generic/list_detail.py2
-rw-r--r--docs/generic_views.txt10
5 files changed, 10 insertions, 9 deletions
diff --git a/AUTHORS b/AUTHORS
index 3aaa3d57ba..a0159bccd0 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -67,6 +67,7 @@ answer newbie questions, and generally made Django that much better:
Andrew Brehaut <http://brehaut.net/blog>
brut.alll@gmail.com
Jonathan Buchanan <jonathan.buchanan@gmail.com>
+ Trevor Caira <trevor@caira.com>
Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com>
Antonio Cavedoni <http://cavedoni.com/>
C8E
diff --git a/django/views/generic/create_update.py b/django/views/generic/create_update.py
index a4559ad495..46e92fe26e 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 d13c0293be..c0f219f280 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 16d55202da..f5616b9745 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 2b80348903..0601aead11 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<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', 'object_detail', dict(info_dict, slug_field='slug')),
+ (r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', 'object_detail', info_dict),
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', 'archive_day', info_dict),
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'archive_month', info_dict),
(r'^(?P<year>\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.