#19378 closed Bug (fixed)
HttpResponseRedirect fail on reverse_lazy with Python 3.2
| Reported by: | anonymous | Owned by: | nobody |
|---|---|---|---|
| Component: | Generic views | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Attachments (1)
Change History (6)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
| Component: | Uncategorized → Generic views |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
Mmmmh... it's not the first time I'm confronted with issues related to the new Python 3 urlparse implementation and its isinstance dance :-(
The problem cannot be triggered in ModelFormMixin-based views because the lazy reverse is resolved by an interpolation (self.success_url % self.object.__dict__). However, it is a problem in FormMixin version of get_success_url, where we probably will have to force the lazy evaluation.
comment:3 by , 13 years ago
| Has patch: | set |
|---|
I was a bit surprised to not find existing FormView tests. Maybe I missed them?
comment:4 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Let's have an example :
In a delete view, you need to do that to fix the problem:
class TaskDeleteView(DeleteView): model = Task success_url = reverse_lazy('task:list') def get_success_url(self): return str(self.success_url)If you don't define get_success_url and return the str() you get and attribute error proxy doesn't have a decode attribute.