Files
@ 462cbc396354
Branch filter:
Location: website/www/conservancy/apps/worldmap/models.py - annotation
462cbc396354
920 B
text/x-python
Supporters list built dynamically.
Hitherto the supporters list has been committed directly to the static
sponsors/index.html file. This was never ideal and a quick hack to
build Conservancy's supporters list at the beginning of the supporters
program.
With this change, a Django app now exists that dynamically generates the
supporters list.
The database rows must be built from Conservancy's internal Ledger file,
which will be done in a separate script.
Hitherto the supporters list has been committed directly to the static
sponsors/index.html file. This was never ideal and a quick hack to
build Conservancy's supporters list at the beginning of the supporters
program.
With this change, a Django app now exists that dynamically generates the
supporters list.
The database rows must be built from Conservancy's internal Ledger file,
which will be done in a separate script.
8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf | from django.db import models
class EarthLocation(models.Model):
"""Represents latitude and longitude, with a label"""
label = models.CharField(max_length=300, unique=True)
latitude = models.DecimalField(max_digits=9, decimal_places=6)
longitude = models.DecimalField(max_digits=9, decimal_places=6)
date_created = models.DateTimeField(auto_now_add=True)
date_last_modified = models.DateTimeField(auto_now=True)
class Meta:
unique_together = (("latitude", "longitude"),)
def __unicode__(self):
return self.label
def google_maps_link(self):
return ("http://maps.google.com/maps?ll=%s,%s&z=15"
% (self.latitude, self.longitude))
default_map_link = google_maps_link
def html_map_link(self): # for Admin, fixme: fix_ampersands
return '<a href="%s">map link</a>' % self.default_map_link()
html_map_link.allow_tags = True
|