djangosnippets.org: Latest snippets tagged with 'location'https://djangosnippets.org/tags/location/2021-03-24T08:13:25.964504-05:00Closest ORM models to a latitude/longitude point
2021-03-24T08:13:25.964504-05:00simonwhttps://djangosnippets.org/snippets/10854/<p>Here's how to find the 10 closest locations to a point for a model that has latitude and longitude columns, if you're not using GeoDjango.</p>
<p>This runs a brute force distance calculation against every row, so it should only be used on smaller tables - probably less than 100,000 rows. …</p>
Freely redistributableUsing URLs for highlighting sections in menu
2010-08-09T17:15:18.659869-05:00divermanhttps://djangosnippets.org/snippets/2143/<p>Use this, if you want to "activate" menu items by URL. Typical usage is with CSS class 'active'.</p>
Freely redistributablelocation context_processor
2009-08-14T08:31:58.699023-05:00gsf0https://djangosnippets.org/snippets/1685/<p>A simple context_processor to include location info. Useful for permalinks, site name references, and navigation bars. For example:</p>
<pre><code>{% if location.path|match:"/$" %} class="current"{% endif %}
</code></pre>
<p>See also my <a href="/snippets/1686/">match filter</a>.</p>
Freely redistributableFire Eagle example: views.py from wikinear.com
2008-03-22T13:50:02.520777-05:00simonhttps://djangosnippets.org/snippets/655/<p>The views.py used by <a href="http://wikinear.com/">wikinear.com</a> - see <a href="http://simonwillison.net/2008/Mar/22/wikinear/">http://simonwillison.net/2008/Mar/22/wikinear/</a></p>
<p>For a more comprehensive API wrapper for Fire Eagle, take a look at <a href="http://github.com/SteveMarshall/fire-eagle-python-binding/tree/master/fireeagle_api.py">fireeagle_api.py</a></p>
Freely redistributable