﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7196	Callback function for date_based.object_detail function	bogdan.agica@…	nobody	"There might be the need of implementing a callback function in the object_detail function. This shoud come after the object query, and before the template rendering, and it might be used for extra processing, such as incrementing a number_of_views counter, for example.

{{{
--- django/django/django/views/generic/date_based.py	2007-12-21 12:12:16.000000000 +0200
+++ date_based.py	2008-05-08 16:50:26.000000000 +0300
@@ -290,7 +290,7 @@
         month_format='%b', day_format='%d', object_id=None, slug=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):
+        template_object_name='object', mimetype=None, allow_future=False, callback_function=None):
     """"""
     Generic detail view from year/month/day/slug or year/month/day/id structure.
 
@@ -326,6 +326,8 @@
         obj = queryset.get(**lookup_kwargs)
     except ObjectDoesNotExist:
         raise Http404, ""No %s found for"" % model._meta.verbose_name
+    if callable(callback_function):
+        callback_function(obj)
     if not template_name:
         template_name = ""%s/%s_detail.html"" % (model._meta.app_label, model._meta.object_name.lower())
     if template_name_field:
}}}"		closed	Generic views	dev		wontfix	date_based callback object_detail		Unreviewed	1	0	0	0	0	0
