Python / Django Forms - Display Form Element Content Instead of Html Element -


i looping through forms , want display of values of form elements. have read .data should take care of me. however, returns "none" , form indeed have field , correct stored value...

{% document in documents: %}     {{ document.title.data }} <!-- note:  returns "none" -->     {{ document.title }} <!-- element correct initial value --> 

any ideas?

merci beaucoup!!!

update:

  1. to access initial value directly forms.charfield(initial=x)
    use {{ document.title.field.initial }}.

  2. accessing initial value passed form constructor (form = myform(initial={...})) doesn't possible via template. boundfield data = self.form.initial.get(self.name, self.field.initial) when rendering widget @ form initial dict, falls form field's initial value.

  3. for bound form you've passed in data, such form = myform(request.post), data available in {{ document.title.data }}

in trunk, boundfield.value returns either initial or data! cool stuff. http://code.djangoproject.com/browser/django/trunk/django/forms/forms.py#l438


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -