If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 0
    brianm  15 years ago
    This is a great addition, thank you! I did run into a problem using it in conjunction with IS_NULL_OR(IS_IN_DB(...)) because OPTIONS_WITH_ADD_LINK couldn't figure out field_name. After some experimenting, if came up with the following work around. 1) I added fourth parameter F which can either be None or the name of the field to use 2) Modified widgetAddLink.py as follows: # Get the parameters request = self.parameters["r"] a = request.application c = self.parameters["c"] T = self.parameters["T"] F = self.parameters["F"] #new paremeter either None or the name of the field to use requires = select.attributes["requires"] # If is not the "IS_IN_DB" validator then can be that the line below fails # because the requires can't have "ks" object try: # Get the field name from the foreign table from validator IS_IN_DB if F == None: field_name = requires.ks[0] or None #original module behavior else: field_name = F #use the one we specified (because there was no "ks" object) except AttributeError: return select

Commented on:

This widget adds a link next to the