#22622 closed Cleanup/optimization (fixed)
Add imports for ugettext_lazy in documentation
Reported by: | anonymous | Owned by: | niclas.ahden |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | afraid-to-commit |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
It shouldn't say:
_("This writer's name is too long.")
it should say:
("This writer's name is too long.")
(in other words, it shouldn't have the underscore)
The code below was taken from: https://docs.djangoproject.com/en/1.6/topics/forms/modelforms/#overriding-the-default-fields
class AuthorForm(ModelForm): class Meta: model = Author fields = ('name', 'title', 'birth_date') labels = { 'name': _('Writer'), } help_texts = { 'name': _('Some useful help text.'), } error_messages = { 'name': { 'max_length': _("This writer's name is too long."), }, }
Change History (6)
comment:1 by , 11 years ago
Keywords: | code error removed |
---|---|
Summary: | Multiple _'s are in the code, although they shouldn't be. → Add imports for ugettext_lazy in documentation |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 11 years ago
Keywords: | afraid-to-commit added |
---|
Ear-marked as suitable for a first-time committer at the DjangoCon Europe sprints 2014.
comment:3 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 11 years ago
Has patch: | set |
---|---|
Version: | 1.6 → master |
I made this change during the sprints at DjangoCon EU 2014.
Pull request posted at:
comment:5 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
Actually the code is correct, but we could add the following import to help clarify:
from django.utils.translation import ugettext_lazy as _