Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26996 closed Bug (wontfix)

Upgrade path for custom Context subclasses isn't documented

Reported by: Arthur Pemberton Owned by: nobody
Component: Documentation Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


It used to be possible to pass a custom context instances to render_to_response. Now that's no longer possible, and there is no recommended upgrade path in the changelog or reference documentation.

Change History (5)

comment:1 by Tim Graham, 8 years ago

Resolution: wontfix
Status: newclosed

Unfortunately, we don't provide upgrade instructions for undocumented and untested use cases.

comment:2 by Aymeric Augustin, 8 years ago

Like Tim, I'm not aware of any public APIs on the Context class that provide a useful extension point, so I don't know where to start to help you. You might want to explain why you were doing this. The DevelopersMailingList is likely a better forum for this discussion than this ticket.

comment:3 by Arthur Pemberton, 8 years ago

I understand. render_to_response used to take a context_instance, and there used to be documentation on subclassing Context. So while not directly mentioned, it was definitely possible to create a subclass of Context or RequestContext and use it with render_to_response.

That's currently not possible with the current code, as of 1.10, which is fine. But it might be worth a note saying that explicitly.

comment:4 by Aymeric Augustin, 8 years ago

Well, technically, you could try passing a subclass of dict as the context argument of render_to_response.

I have no idea whether this is a reasonable way to achieve your goals, since I don't know what you're trying to do, and this is likely not the first thing I would attempt. I'd probably go for a custom template backend if I needed this level of customization. Look at django.template.backends.django, there isn't a lot of code in there.

Version 0, edited 8 years ago by Aymeric Augustin (next)

comment:5 by Arthur Pemberton, 8 years ago

Sorry for being unclear. I wasn't filing this ticket to try to solve my problem, I handled that separately, just pointing out the lack of forewarning in the reference material and release notes.

Note: See TracTickets for help on using tickets.
Back to Top