Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 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)

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.

Attachments (0)

Change History (2)

comment:1 Changed 2 years ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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 Changed 2 years ago by ramiro

  • Description modified (diff)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.