djangosnippets.org: Latest snippets posted by btaylordesignhttp://djangosnippets.org/users/btaylordesign/2011-09-08T00:31:11.139417-05:00btaylordesignMath Captcha Field and Widget
2011-09-08T00:31:11.139417-05:00btaylordesignhttp://djangosnippets.org/snippets/2543/<p>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.</p>
<p>It leverages …</p>
Freely redistributableDynamic Regroup Template Tag
2011-08-11T15:27:51.331234-05:00btaylordesignhttp://djangosnippets.org/snippets/2511/<p>Django's built-in {% regroup %} template tag is great, but sometimes, you need to pass in the attribute you want to group on instead of declaring the attribute when you define the tag.</p>
<p>{% dynamic_regroup %} is identical in function to {% regroup %}, except that it will attempt to …</p>
Freely redistributablemap_path function for settings.py
2011-07-23T19:19:46.633666-05:00btaylordesignhttp://djangosnippets.org/snippets/2494/<p>By using map_path([directory_name]) you can avoid hard coding paths for a specific OS in your settings.py</p>
Freely redistributableSmart Spaceless
2011-04-08T10:20:59.439319-05:00btaylordesignhttp://djangosnippets.org/snippets/2405/<p>This 'smart_spaceless' template tag is a replacement for Django's built-in 'spaceless'. If settings.DEBUG = True, spaces will not be removed to make debugging your template code easier. When DEBUG = False, spaces will be removed.</p>
<p>Happy coding!</p>
Freely redistributableAjaxForm Base Classes
2011-03-16T13:41:22.649760-05:00btaylordesignhttp://djangosnippets.org/snippets/2393/<p>These base form classes add a method to return error messages as HTML encoded as JSON from Django, optionally passing in an argument to strip tags out. The method can be called in your view after checking that your form is valid. There is a ModelForm and Form class to …</p>
Freely redistributableFeet and Inches FormField/Widget
2011-01-18T22:51:47.903069-06:00btaylordesignhttp://djangosnippets.org/snippets/2327/<p>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.
</p>
<p>I have this code broken out into separate files, but you can always combine to suit your needs. I have designated …</p>
Freely redistributable