{{{
class ExampleForm(forms.Form):
def as_table(self):
return render(None, 'example.html', {'form': self})
}}}
and the template refers to a nonexistent attribute on the form:
{{{
{{ form.boom }}
}}}
printing the `VariableDoesNotExist` will cause it to attempt to stringify
the form for context again.
Tentative patch changes it to always `repr()`, which seems appropriate and
has the advantage of showing dict context like this:
{{{
Failed lookup for key [author] in {'section': '"News"'}
}}}
instead of like this:
{{{
Failed lookup for key [author] in '{\'section\': \'"News"\'}'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27783>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Ryan O’Hara
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/27783#comment:1>
* has_patch: 0 => 1
Comment:
https://github.com/django/django/pull/7957
--
Ticket URL: <https://code.djangoproject.com/ticket/27783#comment:2>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/27783#comment:3>
Comment (by Thomas Hauk):
Also the cause of an exception death spiral in DRF, c.f.:
https://github.com/tomchristie/django-rest-framework/issues/3736
Would love to see this patch integrated into Django!
--
Ticket URL: <https://code.djangoproject.com/ticket/27783#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"7c4289d0b974c9b33bdc569308d8c99d7cac45d4" 7c4289d]:
{{{
#!CommitTicketReference repository=""
revision="7c4289d0b974c9b33bdc569308d8c99d7cac45d4"
Fixed #27783 -- Switched VariableDoesNotExist.__str__() to repr() context.
Using __str__() and then repr'ing the result looks strange and can lead
to recursive rendering of forms.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27783#comment:5>