On 5/25/07, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > > I know I could use the templating and put all of this in a template or > possibly a template tag, but wouldn't it be superb if I could do:
Sure. It doesn't need to be in a templatetag, though - just override the format_output method for the MultiWidget to include the javascript. That way, whenever the field is used on a form, the widget will be rendered, and all the javascript and extra goodness goes along with it. > An additional problem is that for the ReCaptchaField.clean() I need the > ip of the person who did the post. How can I pass this without making > the captcha a dynamic field inside the CaptchaTest __init__? Not sure you can. Fields are intentionally divorced from the form they appear on, so there isn't really a way for a form to pass data to a field on a per-instance basis. You could handle it at the form level by writing a factory method, analogous to form_for_model - that is, a method that returns a freshly constructed form class, which you can instantiate. That way, you can pass the IP to the factory method, which will return a form that is bound to a particular IP. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---