Login

Tag "multiwidget"

Snippet List

Math Captcha Field and Widget

This math captcha field and widget was inspired by Justin Quick's django-math-captcha, but I wanted to make it into one form field and not have anything in settings.py. I removed the division and modulo operators to avoid people having to input fractions, and just randomly select the operator. It leverages Django's built-in MultiValueField to set up the hidden hashed answer to compare the user's input to instead of rendering strings for the fields like django-math-captcha does. Unit tests soon to follow, but this is used in production at: http://btaylorweb.com/. Enjoy!

  • simple
  • captcha
  • field
  • widget
  • math
  • multiwidget
  • multifield
Read More

Feet and Inches FormField/Widget

Feet and Inches Widget/Field allows users to enter a value in feet, inches and fractional inches and have that value stored as a decimal in your database of choice. I have this code broken out into separate files, but you can always combine to suit your needs. I have designated file delineation with a single line comment and the name of the file as referenced in the import statements. The INCH_DECIMALS and INCH_FRACTION constants may be modified to allow smaller increments. My needs for this implementation only required accuracy to 1/16. Hope this helps someone learn how to use the MultiWidget and MultiValueFields! Happy Coding.

  • widget
  • multiwidget
  • multifield
  • feet
  • inches
Read More

3 snippets posted so far.