Code

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#6518 closed (invalid)

label_suffix missing

Reported by: cbmeeks <cbmeeks@…> Owned by: nobody
Component: Forms Version: master
Severity: Keywords: label_suffix
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Current documentation (http://www.djangoproject.com/documentation/newforms/) reports that you can change the default colon (:) for labels using the label_suffix argument in the NewForms class.

However, looking at the source code and trying to run an example, I can not find where this label is supported in version 0.96.

I get this error:

init() got an unexpected keyword argument 'label_suffix'
Request Method: GET
Request URL: http://192.168.222.102:8000/contacts/add/
Exception Type: TypeError
Exception Value: init() got an unexpected keyword argument 'label_suffix'
Exception Location: /usr/lib/python2.5/site-packages/django/newforms/fields.py in init, line 129
Python Executable: /usr/bin/python
Python Version: 2.5.1
Python Path: ['/home/bitcircle', '/usr/lib/python25.zip', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/usr/lib/python2.5/lib-dynload', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/Numeric', '/usr/lib/python2.5/site-packages/gtk-2.0']

Either the documentation is wrong (describing a feature that doesn't exist) or the argument has been removed by mistake.

Attachments (0)

Change History (10)

comment:1 Changed 6 years ago by tvrg

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

Have a look at the first line of the docs:
""" This document is for Django's SVN release, which can be significantly different from previous releases. Get old docs here: 0.96, 0.95."""

if you look at the documentation for your version: http://www.djangoproject.com/documentation/0.96/newforms/ you'll see that there is indeed no label suffix mentioned there

comment:2 Changed 6 years ago by cbmeeks <cbmeeks@…>

Sorry, I thought 0.96 was the latest version (SVN release)

comment:3 Changed 6 years ago by tvrg

If you want the SVN release (subversion) you need to check the code out according to these instructions: http://www.djangoproject.com/download/ (option 1)

It might not be a bad idea to use trunk if you want to use newforms.

comment:4 Changed 6 years ago by cbmeeks <cbmeeks@…>

That's what I am using now(Trunk)....or so I thought.

I'm at revision 7049.

hmm....

comment:5 Changed 6 years ago by tvrg

you said: "I can not find where this label is supported in version 0.96.", that's why i thought you were using that version.

I suppose you are putting a suffix in a field definition, not in a form definition? Could you paste your code to dpaste?

comment:6 Changed 6 years ago by cbmeeks <cbmeeks@…>

Well, I was messing with ModelForm to generate.

My forms.py

from django import newforms as forms

class NewContactForm(forms.Form):
	firstname		= forms.CharField( required=False, max_length=64, label='First Name, label_suffix='' )
	

Now, I am using a more direct approach and building my templates using

	{{ form.firstname.errors }}
	<label for="firstname">First Name</label>
	{{ form.firstname }}<br /><br />

Which works for my needs.

comment:7 Changed 6 years ago by cbmeeks <cbmeeks@…>

Sorry, there should be an ' after "First Name"

comment:8 Changed 6 years ago by brosner

In the future please direct usage question to django-users mailing list or #django on freenode. label_suffix is not a parameter that a Field takes. It is passed in to the Form object.

comment:9 Changed 6 years ago by tvrg

brosner beat me to it.

comment:10 Changed 6 years ago by cbmeeks <cbmeeks@…>

Well, I thought this was a bug.

I have the latest trunk (I think...revision 7049) which I *thought* was version 0.96...but I guess it's slightly newer.

But if you look at http://www.djangoproject.com/documentation/newforms/ you will see label_suffix is there. However, I see now that the docs for the "official" version 0.96, label_suffix is NOT there.

Once again, I thought 0.96 was the newest which used the same docs as http://www.djangoproject.com/documentation/newforms/ but I guess it doesn't. My mistake. But when you go to http://www.djangoproject.com/documentation/0.96/newforms/ you see "This document describes Django version 0.96. For current documentation, go here" which points to, well, you get the idea.

I will consult the IRC channel to resolve my confusion.

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.