Django

Code

Ticket #6272 (new)

Opened 1 year ago

Last modified 5 months ago

django.utils.translation.ugettext_lazy needs __add__ support

Reported by: Tai Lee <real.human@mrmachine.net> Assigned to: nobody
Milestone: Component: Core framework
Version: SVN Keywords: ugettext_lazy unicode concatenate
Cc: real.human@mrmachine.net Triage Stage: Design decision needed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by ramiro)

The model fields defined in django.contrib.auth.models (and I assume other parts of django) use django.utils.translation.ugettext_lazy to specify the label (or another property from which the label is derived). The form field objects generated by form_for_* and ModelForm? on these models return a django.utils.functional.__proxy__ object instead of a unicode object where ugettex_lazy is not used.

I have a few helper template tags which are trying to alter the form field label with a concatenation, which is throwing an error for form_for_model and ModelForm? forms for django.contrib.auth.models.User (and other django/contrib models that use ugettext_lazy).

As the documentation doesn't recommend or require the use of ugettext_lazy in it's examples and tutorials when defining models and forms, this inconsistent behaviour seems less than ideal. If django.utils.functional.__proxy__ could be changed with an __add__ (and other?) methods to behave more like a string/unicode object, that would be good?

Attachments

Change History

01/06/08 21:53:41 changed by Simon Greenhill <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

06/23/08 13:39:17 changed by ramiro

  • description changed.

Add/Change #6272 (django.utils.translation.ugettext_lazy needs __add__ support)




Change Properties
Action