Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#13257 closed (wontfix)

label_tag syntax check should also check for blank fields and show no syntax

Reported by: jkatzer Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: label_tag
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:


if for some reason you would like a field in the admin to have a blank label, such as for an extra address field, the admin should not punctuate your empty field with syntax.

yes, i know you might just call that field address2 or anything else, but its your admin and you should be able to do whatever you feel with it. also, this makes sense for the front end form generation, which is where the change needs to be made.

i was trying to do the simple thing by just hacking the template (since this is just presentation after all), but then i found the line that would need to be changed and thought it was worth proposing here...

diff attached...

Attachments (1)

proposed_change.diff (401 bytes) - added by jkatzer 8 years ago.
hacky fix.…

Download all attachments as: .zip

Change History (6)

comment:1 Changed 8 years ago by jkatzer

Needs tests: set

comment:2 Changed 8 years ago by jkatzer

Has patch: unset
Needs tests: unset

disregard the patch... that code does not run unless label_syntax is used (which i assumed admin used)

comment:3 Changed 8 years ago by jkatzer

Has patch: set
Needs tests: set

ok this new patch is really hacky, but it gets the job done for me....

Changed 8 years ago by jkatzer

Attachment: proposed_change.diff added

hacky fix....

comment:4 Changed 8 years ago by Russell Keith-Magee

milestone: 1.2
Resolution: wontfix
Status: newclosed

Am I missing something that isn't possible by saying " f3 = forms.IntegerField(label=) "?

comment:5 Changed 8 years ago by Russell Keith-Magee

Lets try that again:

>>> class MyForm(forms.Form):
...     f1 = forms.IntegerField()
...     f2 = forms.IntegerField(label='test field')
...     f3 = forms.IntegerField(label='')

>>> f = MyForm()
>>> print f.as_p()
<p><label for="id_f1">F1:</label> <input type="text" name="f1" id="id_f1" /></p>
<p><label for="id_f2">test field:</label> <input type="text" name="f2" id="id_f2" /></p>
<p> <input type="text" name="f3" id="id_f3" /></p>
Note: See TracTickets for help on using tickets.
Back to Top