summaryrefslogtreecommitdiff
path: root/app/birds/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-01-21 11:08:43 -0700
committerluxagraf <sng@luxagraf.net>2018-01-21 11:08:43 -0700
commit342e3f0450f2a13fe3f2c99d0cc28d053592293e (patch)
treefb58e7b2b3a1659315162bf7028fd94afd888b6b /app/birds/models.py
parent7dbb0c01c941f933914ff0f0d5567a4a7ac7e99c (diff)
updated code to work with django 2.0
Diffstat (limited to 'app/birds/models.py')
-rw-r--r--app/birds/models.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/birds/models.py b/app/birds/models.py
index 380e602..c73e7d7 100644
--- a/app/birds/models.py
+++ b/app/birds/models.py
@@ -1,5 +1,5 @@
import datetime
-from django.core.urlresolvers import reverse
+from django.urls import reverse
from django.template.defaultfilters import slugify
from django.contrib.gis.db import models
from django.contrib.auth.models import User
@@ -43,7 +43,7 @@ class Bird(models.Model):
slug = models.SlugField()
scientific_name = models.CharField(max_length=200)
code = models.IntegerField(choices=ABA_CODES, default=0)
- bird_class = models.ForeignKey(BirdClass)
+ bird_class = models.ForeignKey(BirdClass, on_delete=models.CASCADE)
image = models.FileField(upload_to=get_upload_path, null=True, blank=True, help_text="width of high res is 1360px")
image_credit = models.CharField(max_length=200, blank=True, null=True)
@@ -71,7 +71,7 @@ class Bird(models.Model):
class BirdAudio(models.Model):
- bird = models.ForeignKey(Bird, related_name='recordings')
+ bird = models.ForeignKey(Bird, on_delete=models.CASCADE, related_name='recordings')
audio = models.FileField(upload_to='audio/birds/')
recorder = models.CharField(max_length=200, null=True, blank=True)
pub_date = models.DateTimeField()
@@ -88,9 +88,9 @@ class BirdAudio(models.Model):
class BirdSighting(models.Model):
- bird = models.ForeignKey(Bird)
+ bird = models.ForeignKey(Bird, on_delete=models.CASCADE)
point = models.PointField(blank=True)
- location = models.ForeignKey(Location, blank=True)
+ location = models.ForeignKey(Location, on_delete=models.CASCADE, blank=True)
date = models.DateTimeField('Date', default=timezone.now)
seen_by = models.ManyToManyField(User)
images = models.ManyToManyField(LuxImage, blank=True)