#25397: DetailView of User model breaks user context variable in templates
-----------------------------------+--------------------------------------
Reporter: mathieuhinderyckx | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by mlorant):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Your solution seems to break forward compatibility, since the ''public''
method `get_context_object_name` describes the default behavior in the
current documentation: [https://docs.djangoproject.com/en/1.8/ref/class-
based-views/mixins-single-
object/#django.views.generic.detail.SingleObjectMixin.get_context_object_name],
plus I think it is a good implementation, besides this case...
Maybe we could either :
- exclude some reserved variable names (especially user and site).
Problem: not really pretty and would be reserved to variables included by
Django ;
- change the behaviour if the variable is already used by one of the
installed middleware. Problem: if you remove a middleware, it might break
the generic view template (since the variable could be renamed as a side
effect).
Both solutions have limits, especially the second one...
--
Ticket URL: <https://code.djangoproject.com/ticket/25397#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/075.7fc8341093d3eddbbaf728065ac4dc07%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.