diff options
Diffstat (limited to 'app/birds')
-rw-r--r-- | app/birds/build.py | 2 | ||||
-rw-r--r-- | app/birds/models.py | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/app/birds/build.py b/app/birds/build.py index 870133f..565b675 100644 --- a/app/birds/build.py +++ b/app/birds/build.py @@ -1,5 +1,5 @@ import os -from django.core.urlresolvers import reverse +from django.urls import reverse from builder.base import BuildNew 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) |