Opened 13 years ago

Closed 7 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


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) (450 bytes) - added by Beuc 13 years ago.

Download all attachments as: .zip

Change History (8)

Changed 13 years ago by Beuc

Attachment: added

comment:1 Changed 13 years ago by Beuc

However the change apparently requires all verbose_name / verbose_name_plural to be explicitely declared as u"".

Previously I could use:

# -*- coding: utf-8 -*-

Now it's necessary to also mark the string as unicode:

# -*- coding: utf-8 -*-

otherwise I now get:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)

This is inconvenient.

comment:2 Changed 13 years ago by Russell Keith-Magee

Component: UncategorizedDatabase layer (models, ORM)
Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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 Changed 12 years ago by Luke Plant

Type: Bug

comment:4 Changed 12 years ago by Luke Plant

Severity: Normal

comment:5 Changed 11 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 Changed 11 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 Changed 7 years ago by Tim Graham

Resolution: worksforme
Status: newclosed

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).

Note: See TracTickets for help on using tickets.
Back to Top