Extension to render to rename id

svn: r19529
This commit is contained in:
Doug Blank 2012-05-15 20:16:39 +00:00
parent 48c1b83e21
commit 58c54609df

View File

@ -599,7 +599,8 @@ def display_date(obj):
else:
return ""
def render(formfield, user, action, test=False, truetext=""):
def render(formfield, user, action, test=False, truetext="", id=None):
#import pdb; pdb.set_trace()
if not user.is_authenticated():
action = "view"
if action == "view":
@ -610,11 +611,14 @@ def render(formfield, user, action, test=False, truetext=""):
except:
# name, "prefix"
try:
retval = str(getattr(formfield.form, fieldname)) # formfield._data()
retval = str(formfield.form.data[fieldname]) # formfield._data()
except:
retval = "XXX"
else:
retval = truetext
else:
if id != None:
retval = formfield.as_widget(attrs={"id": id})
else:
retval = formfield.as_widget()
return retval