Opened 3 years ago

Closed 3 years ago

Last modified 3 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

Description

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 Changed 3 years ago by Tim Graham

Resolution: wontfix
Status: newclosed

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

comment:2 Changed 3 years ago by Aymeric Augustin

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 Changed 3 years ago by Arthur Pemberton

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 Changed 3 years ago by Aymeric Augustin

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.

To discuss this further, you'll have to explain your use case...

Last edited 3 years ago by Aymeric Augustin (previous) (diff)

comment:5 Changed 3 years ago by Arthur Pemberton

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