Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#6518 closed (invalid)

label_suffix missing

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

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.

Change History (10)

comment:1 by Tom Vergote, 17 years ago

Resolution: invalid
Status: newclosed

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 by cbmeeks <cbmeeks@…>, 17 years ago

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

comment:3 by Tom Vergote, 17 years ago

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 by cbmeeks <cbmeeks@…>, 17 years ago

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

I'm at revision 7049.

hmm....

comment:5 by Tom Vergote, 17 years ago

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 by cbmeeks <cbmeeks@…>, 17 years ago

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 by cbmeeks <cbmeeks@…>, 17 years ago

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

comment:8 by Brian Rosner, 17 years ago

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 by Tom Vergote, 17 years ago

brosner beat me to it.

comment:10 by cbmeeks <cbmeeks@…>, 17 years ago

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.

Note: See TracTickets for help on using tickets.
Back to Top