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 %}

5 Responses to “Django GeoIP templatetag”

  1. Archatas Says:

    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.

  2. zenx Says:

    very useful! thank youuu!! :D

  3. Steven Armstrong Says:

    Sweet! Just what I’ve been looking for.
    Thanks for sharing.

  4. Anonymous Says:

    GeoIP is the ip location technology by MaxMind

  5. geoff Says:

    I added something on my blog about country detection in Django from IP without using Maxmind.
    http://boomby.com/?p=3

Leave a Reply