Open rixx opened 11 months ago
Interesting suggestions!
I did a quick POC for the first two (#931), but they'll have to be documented still. Can you show an example of how you imagine the third suggestion should work?
Oh cool! I think if 2) is implemented, 3) won't be needed in addition – subclassing is more troublesome anyway than just passing a callable parameter.
I'm migrating a larger project towards
django-tables2
, and I'd like to reuse some snippets both for tables and for other locations.TemplateColumn
fills that niche very nicely, but it's hard-coded to userecord
as context object name, which doesn't play well with existing templates.There are several ways this could be solved with fairly minimal impact:
context_object_name
like in other Django places, defaulting torecord
extra_context
to be a callable, passing the arguments received byrender()
get_context_data
method allowing for easy subclassing