mirror of https://github.com/django/django.git
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
This commit is contained in:
parent
f6e86c4286
commit
56e28b4e8f
1
AUTHORS
1
AUTHORS
|
@ -67,6 +67,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Andrew Brehaut <http://brehaut.net/blog>
|
Andrew Brehaut <http://brehaut.net/blog>
|
||||||
brut.alll@gmail.com
|
brut.alll@gmail.com
|
||||||
Jonathan Buchanan <jonathan.buchanan@gmail.com>
|
Jonathan Buchanan <jonathan.buchanan@gmail.com>
|
||||||
|
Trevor Caira <trevor@caira.com>
|
||||||
Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com>
|
Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com>
|
||||||
Antonio Cavedoni <http://cavedoni.com/>
|
Antonio Cavedoni <http://cavedoni.com/>
|
||||||
C8E
|
C8E
|
||||||
|
|
|
@ -71,7 +71,7 @@ def create_object(request, model, template_name=None,
|
||||||
return HttpResponse(t.render(c))
|
return HttpResponse(t.render(c))
|
||||||
|
|
||||||
def update_object(request, model, object_id=None, slug=None,
|
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,
|
extra_context=None, post_save_redirect=None,
|
||||||
login_required=False, follow=None, context_processors=None,
|
login_required=False, follow=None, context_processors=None,
|
||||||
template_object_name='object'):
|
template_object_name='object'):
|
||||||
|
@ -146,7 +146,7 @@ def update_object(request, model, object_id=None, slug=None,
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def delete_object(request, model, post_delete_redirect,
|
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,
|
template_loader=loader, extra_context=None,
|
||||||
login_required=False, context_processors=None, template_object_name='object'):
|
login_required=False, context_processors=None, template_object_name='object'):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -286,7 +286,7 @@ def archive_today(request, **kwargs):
|
||||||
|
|
||||||
def object_detail(request, year, month, day, queryset, date_field,
|
def object_detail(request, year, month, day, queryset, date_field,
|
||||||
month_format='%b', day_format='%d', object_id=None, slug=None,
|
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_loader=loader, extra_context=None, context_processors=None,
|
||||||
template_object_name='object', mimetype=None, allow_future=False):
|
template_object_name='object', mimetype=None, allow_future=False):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -87,7 +87,7 @@ def object_list(request, queryset, paginate_by=None, page=None,
|
||||||
return HttpResponse(t.render(c), mimetype=mimetype)
|
return HttpResponse(t.render(c), mimetype=mimetype)
|
||||||
|
|
||||||
def object_detail(request, queryset, object_id=None, slug=None,
|
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,
|
template_loader=loader, extra_context=None,
|
||||||
context_processors=None, template_object_name='object',
|
context_processors=None, template_object_name='object',
|
||||||
mimetype=None):
|
mimetype=None):
|
||||||
|
|
|
@ -40,7 +40,7 @@ simple weblog app that drives the blog on djangoproject.com::
|
||||||
}
|
}
|
||||||
|
|
||||||
urlpatterns = patterns('django.views.generic.date_based',
|
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})/(?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})/(?P<month>[a-z]{3})/$', 'archive_month', info_dict),
|
||||||
(r'^(?P<year>\d{4})/$', 'archive_year', 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
|
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
|
``slug_field`` should be the name of the slug field in the ``QuerySet``'s
|
||||||
model.
|
model. By default, ``slug_field`` is ``'slug'``.
|
||||||
|
|
||||||
**Optional arguments:**
|
**Optional arguments:**
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ A page representing an individual object.
|
||||||
|
|
||||||
Otherwise, ``slug`` should be the slug of the given object, and
|
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
|
``slug_field`` should be the name of the slug field in the ``QuerySet``'s
|
||||||
model.
|
model. By default, ``slug_field`` is ``'slug'``.
|
||||||
|
|
||||||
**Optional arguments:**
|
**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
|
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
|
``slug_field`` should be the name of the slug field in the ``QuerySet``'s
|
||||||
model.
|
model. By default, ``slug_field`` is ``'slug'``.
|
||||||
|
|
||||||
**Optional arguments:**
|
**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
|
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
|
``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
|
* ``post_delete_redirect``: A URL to which the view will redirect after
|
||||||
deleting the object.
|
deleting the object.
|
||||||
|
|
Loading…
Reference in New Issue