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,13 +611,16 @@ 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: else:
retval = formfield.as_widget() if id != None:
retval = formfield.as_widget(attrs={"id": id})
else:
retval = formfield.as_widget()
return retval return retval
def render_name(name, user): def render_name(name, user):