Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#17803 closed Bug (worksforme)

Field name with underscore means label not correctly shown in form

Reported by: phoebebright@… Owned by: nobody
Component: Uncategorized Version: 1.3
Severity: Normal Keywords: form, label
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

Is this a bug?

If I have this in my model:

    account_type = models.CharField(_('Type of Business'), max_length=25, blank=True, null=True, help_text='What would your heading in a Directory be')

The in a model form the field name is "Account type" and there is no help text.

If I change it to:

    accounttype = models.CharField(_('Type of Business'), max_length=25, blank=True, null=True, help_text='What would your heading in a Directory be')

Form correctly has label of Type of Business and help text is displayed.

BUT it is not consistent,

This is the form:

class NameForm(forms.ModelForm):

    class Meta:
        model = Account
        fields = ('name', 'contact_details','accounttype','turnover')

And this is another field with an underscore and it displays the label and help text correctly:

    contact_details = models.TextField(_('Contact and Name'), blank=True, null=True, help_text='Actual Business Name and email/telephone if different from yours.')

I can dig some more if this might be a bug.....
Using current version 1.3.1 of django.

Change History (2)

comment:1 by Claude Paroz, 12 years ago

Resolution: worksforme
Status: newclosed

I tried to reproduce with 1.3 and 1.4 code, but with no luck. So I suggest you dig a little more to see what's happening. Check also in the Django admin interface if the label/help text are showing correctly for account_type field.

comment:2 by Ramiro Morales, 12 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top