jieter / django-tables2

django-tables2 - An app for creating HTML tables
https://django-tables2.readthedocs.io/en/latest/
Other
1.86k stars 426 forks source link

Feature request: Make TemplateColumn more dynamic #928

Open rixx opened 11 months ago

rixx commented 11 months ago

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 use record as context object name, which doesn't play well with existing templates.

There are several ways this could be solved with fairly minimal impact:

jieter commented 10 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?

rixx commented 10 months ago

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.