Code

#20618 closed Bug (fixed)

Giving a field an empty label breaks `BoundField.label_tag` (IndexError)

Reported by: bmispelon Owned by: bmispelon
Component: Forms Version: master
Severity: Release blocker Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: no UI/UX: no

Description

The following code shows the regression:

from django import forms

class F(forms.Form):
    foo = forms.CharField(label='')

print(F()['foo'].label_tag())

On django 1.5, this prints <label for="id_foo"></label>. On master, it raises an IndexError.

This is regression was introduced by 584bd14dcfdee9585fec7794d53ce120ea73d0bc.
Previously, calling the label_tag on a field with an empty label would

Attachments (0)

Change History (1)

comment:1 Changed 13 months ago by Baptiste Mispelon <bmispelon@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 3128f3d38d1db0bc01da9a4bf4be81119079d73a:

Fixed #20618 -- Fixed regression in BoundField.label_tag.

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.