#13659: Made the request accessible in callables used in ModelAdmin.list_display [PATCH] -------------------------------------------+------------------------------- Reporter: sebastian_noack | Owner: nobody Type: New feature | Status: new Milestone: | Component: contrib.admin Version: 1.2 | Severity: Normal Resolution: | Keywords: Triage Stage: Accepted | Has patch: 1 Needs documentation: 1 | Needs tests: 0 Patch needs improvement: 1 | Easy pickings: 0 -------------------------------------------+------------------------------- Changes (by julien):
* needs_better_patch: 0 => 1 * easy: => 0 Comment: I think there's a problem with this patch. The `request` parameter in `lookup_field` could be `None`, which would happen when called from `AdminReadonlyField.contents()`. This means that the callable may receive `None` in some cases, which is a shame. The callable should always receive the `HTTPRequest` object. Also, I think it would make more sense (and be more consistent with the way `ModelAdmin`'s methods work) if the request was provided as the first argument, e.g.: {{{ def my_function(request, ...): ... }}} or: {{{ def my_method(self, request, ...): ... }}} And finally, I'd prefer the function attribute to be called `takes_request`, for consistency with `takes_context` in the `inclusion_tag`. -- Ticket URL: <http://code.djangoproject.com/ticket/13659#comment:8> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.