Django GeoIP templatetag
I’ve published 2 template tags for use with GeoIP at geoip.py.
Hope they may be of use…
Usage:
# Templatetag get_country_name returns the client’s country code
#
# Example:
# {% ifequal get_country “GB” %}
# do something
# {% endifequal %}
# Templatetag get_country sets the given variable name
# to the client’s country code
#
# Example:
# {% get_country as my_country %}
# {% ifequal my_country “GB” %}
# do something
# {% endifequal %}
November 2nd, 2006 at 9:16 am
That’s a nice and useful template tag, but you should also mention, what GeoIP is and where to get it.
Of course, everybody can google for it, but it would be just more convenient to get from one place.
November 2nd, 2006 at 10:07 am
very useful! thank youuu!!
November 2nd, 2006 at 2:12 pm
Sweet! Just what I’ve been looking for.
Thanks for sharing.
December 12th, 2006 at 8:43 pm
GeoIP is the ip location technology by MaxMind
March 1st, 2007 at 10:47 am
I added something on my blog about country detection in Django from IP without using Maxmind.
http://boomby.com/?p=3