Skip to content

Commit

Permalink
Merge pull request #21 from jamesturk/boundary_set_dates
Browse files Browse the repository at this point in the history
add start_date & end_date fields
  • Loading branch information
James McKinney committed Aug 1, 2014
2 parents ea32a79 + 5a12328 commit c10aead
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions boundaries/management/commands/loadshapefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def load_set_2(self, slug, config, options, datasources):
source_url=config.get('source_url', ''),
notes=config.get('notes', ''),
licence_url=config.get('licence_url', ''),
start_date=config.get('start_date', None),
end_date=config.get('end_date', None),
# Load from either the 'extra' or 'metadata' fields
extra=config.get('extra', config.get('metadata', None))
)
Expand Down
6 changes: 5 additions & 1 deletion boundaries/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class BoundarySet(models.Model):
help_text='The URL to the text of the licence this data is distributed under')
extent = JSONField(blank=True, null=True,
help_text='The bounding box of the boundaries in EPSG:4326 projection, as a list such as [xmin, ymin, xmax, ymax].')
start_date = models.DateField(
help_text='The date on which this set of boundaries went into effect.', null=True)
end_date = models.DateField(
help_text='The date on which this set of boundaries was superceded.', null=True)
extra = JSONField(blank=True, null=True,
help_text="Any other nonstandard metadata provided when creating this boundary set.")

Expand All @@ -69,7 +73,7 @@ def __str__(self):
name_plural = property(lambda s: s.name)
name_singular = property(lambda s: s.singular)

api_fields = ('name_plural', 'name_singular', 'authority', 'domain', 'source_url', 'notes', 'licence_url', 'last_updated', 'extent', 'extra')
api_fields = ('name_plural', 'name_singular', 'authority', 'domain', 'source_url', 'notes', 'licence_url', 'last_updated', 'extent', 'extra', 'start_date', 'end_date')
api_fields_doc_from = { 'name_plural': 'name', 'name_singular': 'singular' }

def as_dict(self):
Expand Down

0 comments on commit c10aead

Please sign in to comment.