Django

Code

Ticket #4039 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

New forms and the set_language redirect view don't work together

Reported by: anonymous Assigned to: hugo
Milestone: Component: Internationalization
Version: 0.96 Keywords: unicode-branch
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

When using the 'set_language redirect view' along with newforms, where the newform fields' labels are marked with gettext_lazy, after the view is reloaded, the fields' labels are still in the original language (while template internationalized string are actualized).

Example code for the form:

from django import newforms as forms
from django.utils.translation import gettext_lazy as _

class GetInForm(forms.Form):
    name = forms.CharField(label=_('Name'), max_length=30)
    password = forms.CharField(label=_('Password'),
                                 widget=forms.PasswordInput(render_value=False))

View code:

from django.shortcuts import render_to_response
from django.template import RequestContext
import GetInForm
def getin(request):
    return render_to_response('template_name',
                                  {'test': _('Hello'), 'form': GetInForma().as_p()},
                                  context_instance=RequestContext(request))

Inside the template, the set_language redirect view' is used. Hello is translated, but the form labels no.

Attachments

Change History

04/14/07 19:49:25 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

06/11/07 20:00:55 changed by mtredinnick

  • keywords set to unicode-branch.

This is fixed on the Unicode branch and will be closed when that branch is merged into trunk.

07/04/07 07:11:05 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [5609]) Merged Unicode branch into trunk (r4952:5608). This should be fully backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


Add/Change #4039 (New forms and the set_language redirect view don't work together)




Change Properties
Action