Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed typos in generic-views documentation

git-svn-id: http://code.djangoproject.com/svn/django/trunk@434 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b7e226d8b8ebce1081ff74c0fff7406390fa2402 1 parent a90e9f4
@adrianholovaty adrianholovaty authored
Showing with 13 additions and 12 deletions.
  1. +8 −8 django/views/generic/list_detail.py
  2. +5 −4 docs/generic_views.txt
View
16 django/views/generic/list_detail.py
@@ -6,7 +6,7 @@
from django.core.paginator import ObjectPaginator, InvalidPage
from django.core.exceptions import Http404, ObjectDoesNotExist
-def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False,
+def object_list(request, app_label, module_name, paginate_by=None, allow_empty=False,
template_name=None, extra_lookup_kwargs={}, extra_context={}):
"""
Generic list of objects.
@@ -64,28 +64,28 @@ def object_list(request, app_label, module_name, paginate_by=None, allow_empty=F
for key, value in extra_context.items():
if callable(value):
c[key] = value()
- else:
+ else:
c[key] = value
if not template_name:
template_name = "%s/%s_list" % (app_label, module_name)
t = template_loader.get_template(template_name)
return HttpResponse(t.render(c))
-def object_detail(request, app_label, module_name, object_id=None, slug=None,
- slug_field=None, template_name=None, template_name_field=None,
+def object_detail(request, app_label, module_name, object_id=None, slug=None,
+ slug_field=None, template_name=None, template_name_field=None,
extra_lookup_kwargs={}, extra_context={}):
"""
Generic list of objects.
- Templates: ``<app_label>/<module_name>_list``
+ Templates: ``<app_label>/<module_name>_detail``
Context:
object
- the object (whoa!)
+ the object
"""
mod = models.get_module(app_label, module_name)
lookup_kwargs = {}
if object_id:
- lookup_kwargs['%s__exact' % mod.Klass._meta.pk.name] = object_id
+ lookup_kwargs['pk'] = object_id
elif slug and slug_field:
lookup_kwargs['%s__exact' % slug_field] = slug
else:
@@ -108,7 +108,7 @@ def object_detail(request, app_label, module_name, object_id=None, slug=None,
for key, value in extra_context.items():
if callable(value):
c[key] = value()
- else:
+ else:
c[key] = value
response = HttpResponse(t.render(c))
populate_xheaders(request, response, app_label, module_name, getattr(object, object._meta.pk.name))
View
9 docs/generic_views.txt
@@ -193,12 +193,13 @@ The date-based generic functions are:
Using list/detail generic views
===============================
-The list-detail generic views (in the ``django.views.generic.list_detail``
-module) are similar to the data-based ones, except the list-detail views simply
-have two views: a list of objects, and an individual object page.
+The list-detail generic-view framework (in the
+``django.views.generic.list_detail`` module) is similar to the date-based one,
+except the former simply has two views: a list of objects and an individual
+object page.
All these views take the same three optional arguments as the date-based ones
-(and they obviously do not accept or require the date field argument).
+-- and, clearly, they don't accept the ``date_field`` argument.
Individual views are:
Please sign in to comment.
Something went wrong with that request. Please try again.