Commit 6d2ae864 authored by Evili del Rio's avatar Evili del Rio

Upgrade to Django 2.2

parent b635996d
...@@ -45,15 +45,15 @@ INSTALLED_APPS = [ ...@@ -45,15 +45,15 @@ INSTALLED_APPS = [
'clades', 'clades',
] ]
MIDDLEWARE_CLASSES = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
] ]
ROOT_URLCONF = 'birding.urls' ROOT_URLCONF = 'birding.urls'
......
...@@ -29,23 +29,23 @@ class Kingdom(BaseName): ...@@ -29,23 +29,23 @@ class Kingdom(BaseName):
class Phylum(BaseName): class Phylum(BaseName):
kingdom = models.ForeignKey(Kingdom) kingdom = models.ForeignKey(Kingdom, on_delete=models.PROTECT)
class Classe(BaseName): class Classe(BaseName):
phylum = models.ForeignKey(Phylum) phylum = models.ForeignKey(Phylum, on_delete=models.PROTECT)
class Ordo(BaseName): class Ordo(BaseName):
classe = models.ForeignKey(Classe) classe = models.ForeignKey(Classe, on_delete=models.PROTECT)
class Family(BaseName): class Family(BaseName):
ordo = models.ForeignKey(Ordo) ordo = models.ForeignKey(Ordo, on_delete=models.PROTECT)
class Genus(BaseName): class Genus(BaseName):
family = models.ForeignKey(Family) family = models.ForeignKey(Family, on_delete=models.PROTECT)
class LocaleManager(models.Manager): class LocaleManager(models.Manager):
...@@ -80,7 +80,7 @@ class Species(BaseName): ...@@ -80,7 +80,7 @@ class Species(BaseName):
taxonomic rank. A species is often defined as a group of organisms capable taxonomic rank. A species is often defined as a group of organisms capable
of interbreeding and producing fertile offspring. of interbreeding and producing fertile offspring.
""" """
genus = models.ForeignKey(Genus) genus = models.ForeignKey(Genus, on_delete=models.PROTECT)
def sci_name(self): def sci_name(self):
...@@ -135,8 +135,8 @@ class CommonName(models.Model): ...@@ -135,8 +135,8 @@ class CommonName(models.Model):
""" """
cname = models.CharField(max_length=127) cname = models.CharField(max_length=127)
species = models.ForeignKey(Species) species = models.ForeignKey(Species, on_delete=models.PROTECT)
locale = models.ForeignKey(Locale) locale = models.ForeignKey(Locale, on_delete=models.PROTECT)
def __unicode__(self): def __unicode__(self):
return u'{0} ({1})'.format(self.cname, self.species.sci_name()) return u'{0} ({1})'.format(self.cname, self.species.sci_name())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment