Skip to content

Instantly share code, notes, and snippets.

@dylanvee
Created January 20, 2011 02:28
Show Gist options
  • Save dylanvee/787301 to your computer and use it in GitHub Desktop.
Save dylanvee/787301 to your computer and use it in GitHub Desktop.
Django model definitions for Collector, Observation, and USDA Query
from django.db import models
# Collectors run for each county both when a new user requests data and periodically for existing users.
class Collector(models.Model):
name = models.CharField(max_length=100)
priority = models.IntField()
# Collectors create Observations
class Observation(models.Model):
scientific_name = models.CharField(max_length=100)
common_name = models.CharField(max_length=100)
observation_time = models.DateTimeField()
latitude = models.FloatField()
longitude = models.FloatField()
thumbnail = models.ImageField()
image = models.URLField()
credit = models.CharField(max_length=100)
source = models.ForeignKey(Collector)
# Cache USDA queries by parameters and county
class USDAQuery(models.Model):
name = models.CharField(max_length=100)
last_run = models.DateTimeField()
county_name = models.CharField(max_length=100)
state_name = models.CharField(max_length=100)
request_data = modelsTextField()
response_data = modelsTextField()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment