summaryrefslogtreecommitdiff
path: root/app/birds/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/birds/models.py')
-rw-r--r--app/birds/models.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/app/birds/models.py b/app/birds/models.py
index 3dd0add..3fb0c0f 100644
--- a/app/birds/models.py
+++ b/app/birds/models.py
@@ -2,18 +2,19 @@ import datetime
from django.contrib.gis.db import models
from locations.models import Location
+
def get_upload_path(self, filename):
- return "images/bird-images/%s/%s" %(datetime.datetime.today().strftime("%Y"), filename)
+ return "images/bird-images/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename)
-#from http://aba.org/checklist/codes.html
+# from http://aba.org/checklist/codes.html
ABA_CODES = (
- (1, 'regular occurring - common'),
- (2, 'regular occurring - less common'),
- (3, 'rare'),
- (4, 'casual'),
- (5, 'accidental'),
- (6, 'Cannot be found'),
- )
+ (1, 'regular occurring - common'),
+ (2, 'regular occurring - less common'),
+ (3, 'rare'),
+ (4, 'casual'),
+ (5, 'accidental'),
+ (6, 'Cannot be found'),
+)
class BirdClass(models.Model):
@@ -22,10 +23,11 @@ class BirdClass(models.Model):
class Meta:
verbose_name_plural = 'Bird Class'
-
+
def __str__(self):
return self.common_name
+
class Bird(models.Model):
common_name = models.CharField(max_length=200)
scientific_name = models.CharField(max_length=200)
@@ -34,11 +36,11 @@ class Bird(models.Model):
def __str__(self):
return self.common_name
-
+
+
class BirdSighting(models.Model):
bird = models.ForeignKey(Bird)
point = models.PointField()
location = models.ForeignKey(Location)
date = models.DateTimeField('Date')
- image = models.FileField(upload_to=get_upload_path, null=True,blank=True)
-
+ image = models.FileField(upload_to=get_upload_path, null=True, blank=True)