Forms builder in Mezzanine is ported from (my own project) django-forms-builder, which shows an example in its README:
https://github.com/stephenmcd/django-forms-builder#custom-fields-and-widgets You'll see notes there about a more robust way of choosing the field IDs - your current approach would break if a new field was added to Mezzanine's code. On Mon, Dec 21, 2015 at 5:54 AM, Alexander Tyapkov <[email protected]> wrote: > I have updated Mezzanine to 4.0.1 and found out that the code which > registers additional field for forms is not working anymore. > I also want to move to reCaptcha. For that I have downloaded > django-recaptcha and have following code: > > from captcha import fields as captcha_fields > > GREATEST_ID = max(c[0] for c in mezzanine_fields.NAMES) > ID = GREATEST_ID + 1 > NAME = 'CAPTCHA' > setattr(mezzanine_fields, NAME, ID) > mezzanine_fields.NAMES = list(mezzanine_fields.NAMES) > mezzanine_fields.NAMES.append((ID, _('Captcha'))) > > mezzanine_fields.NAMES = tuple(mezzanine_fields.NAMES) > mezzanine_fields.CLASSES[ID] = captcha_fields.ReCaptchaField > > The problem is that registered field doesnt appear in admin. Can anybody > suggest something? > > P.S. Also I have found that it is possible to user FORM_EXTRA_FIELDS in > settings but no good example is provided. Can that help? Can anybody post > an example of usage? > > -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Stephen McDonald http://jupo.org -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
