contrib.syndication.views: Add hook for getting extra context in feed templates
|Reported by:||slinkp||Owned by:||zsiciarz|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
This seems to me like a useful low-impact hook for authors of Feed subclasses...
I was writing one today and wished I had such a hook.
It would be intentionally similar to the get_context_data hook on class-based views.
Usage would look like:
class MyFeed(Feed): def get_context_data(**kwargs): context = super(MyFeed, self).get_context_data(**kwargs) context['foo'] = settings.FOO context['more_things'] = app.models.Things.objects.filter(...) return context
The description_template and title_template could then make use of the extra context variables.
Attaching a patch; will write tests if this seems worthwhile.
Change History (8)
Changed 2 years ago by slinkp
comment:1 Changed 2 years ago by slinkp
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Type changed from Uncategorized to New feature
comment:2 Changed 20 months ago by aaugustin
- Easy pickings set
- Needs documentation set
- Needs tests set
- Triage Stage changed from Unreviewed to Accepted
comment:5 Changed 13 months ago by zsiciarz
- Owner changed from nobody to zsiciarz
- Status changed from new to assigned