Login

Snippets by b23

Snippet List

HTML color code field

A CharField (Model) that checks that the value is a valid HTML color code (Hex triplet) like #FFEE00.

  • model
  • db
  • color
  • hexcode
Read More
Author: b23
  • 1
  • 4

BBCode templatefilter (generate & strip)

Parse a string for [BBCode](http://en.wikipedia.org/wiki/Bbcode) and generate it to (X)HTML by using the [postmarkup libary](http://code.google.com/p/postmarkup/). In your template for generating (X)HTML: {% load bbcode %} {{ value|bbcode }} In your template for removing BBCode fragments: {% load bbcode %} {{ value|strip_bbcode }}

  • template
  • templatetag
  • templatefilter
  • bbcode
  • xhmtl
Read More
Author: b23
  • 2
  • 8

Get Latitude and Longitude from google maps

I use this to integrate a google map in a form renderd by newforms. If someone click on the map and set a icon, the Latitude and Longitude data goes into the 2 form fields. You need to generate a google API key (http://www.google.com/apis/maps/signup.html) for the GOOGLE_KEY variable.

  • google
  • latitude
  • longitude
  • googlemaps
Read More
Author: b23
  • 1
  • 14

Include captchas from recaptcha.net

Recaptcha is a free service that helps you protect your forms against spam bots by displaying a picture showing 2 words or playing an audio file telling 8 digits for the visually handicapped. After registration on http://recaptcha.net a private and a public key are generated. Put the keys in settings.py. Find client code for recaptcha at http://pypi.python.org/pypi/recaptcha-client. Put the file captcha.py into application root.

  • captcha
  • recaptcha
Read More
Author: b23
  • 8
  • 29

b23 has posted 4 snippets.