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: else:
return "" 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(): if not user.is_authenticated():
action = "view" action = "view"
if action == "view": if action == "view":
@ -610,11 +611,14 @@ def render(formfield, user, action, test=False, truetext=""):
except: except:
# name, "prefix" # name, "prefix"
try: try:
retval = str(getattr(formfield.form, fieldname)) # formfield._data() retval = str(formfield.form.data[fieldname]) # formfield._data()
except: except:
retval = "XXX" retval = "XXX"
else: else:
retval = truetext retval = truetext
else:
if id != None:
retval = formfield.as_widget(attrs={"id": id})
else: else:
retval = formfield.as_widget() retval = formfield.as_widget()
return retval return retval