Opened 15 years ago
Closed 9 years ago
#13019 closed Bug (worksforme)
create_update: proxy object displayed instead of model verbose name
Reported by: | Beuc | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | yes | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
I get this kind of error at http://localhost:8000/users/10/
No <django.utils.functional.__proxy__ object at 0x85c2fcc> found for {'username__exact': u'10'}
Apparently this is due to its non-unicode expansion:
# Note: User.Meta.verbose_name == _('user') raise Http404("No %s found for %s" % (model._meta.verbose_name, lookup_kwargs))
It's fixed by using a Unicode string:
u"No %s found for %s"
Patch attached.
Attachments (1)
Change History (8)
by , 15 years ago
Attachment: | create_update.py.patch added |
---|
comment:1 by , 15 years ago
comment:2 by , 15 years ago
Component: | Uncategorized → Database layer (models, ORM) |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
It's not a bug to require unicode strings when defining unicode text. However, the return value for create_update is clearly problematic. I'm not sure just making the string unicode is the right response; HTTP responses need to be ascii strings.
comment:3 by , 14 years ago
Type: | → Bug |
---|
comment:4 by , 14 years ago
Severity: | → Normal |
---|
comment:7 by , 9 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I think this has probably been fixed. If not, please reopen with an explanation of how to reproduce (I am not sure what create_update
is).
However the change apparently requires all verbose_name / verbose_name_plural to be explicitely declared as u"".
Previously I could use:
Now it's necessary to also mark the string as unicode:
otherwise I now get:
This is inconvenient.