Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 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:

Description

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 4 years ago.
hacky fix.…

Download all attachments as: .zip

Change History (6)

comment:1 Changed 4 years ago by jkatzer

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset

comment:2 Changed 4 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 4 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 4 years ago by jkatzer

hacky fix....

comment:4 Changed 4 years ago by russellm

  • milestone 1.2 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

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

comment:5 Changed 4 years ago by russellm

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>

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.