diff --git a/dpdapi/migrations/0001_initial.py b/dpdapi/migrations/0001_initial.py index 83d93ed..6cce1d7 100644 --- a/dpdapi/migrations/0001_initial.py +++ b/dpdapi/migrations/0001_initial.py @@ -46,7 +46,7 @@ class Migration(migrations.Migration): ('updated', models.DateTimeField(auto_now=True)), ('email', models.EmailField(unique=True, max_length=254)), ('password', models.CharField(max_length=109)), - ('domain', models.ForeignKey(to='dpdapi.Domain')), + ('domain', models.ForeignKey(to='dpdapi.Domain', on_delete=models.CASCADE)), ], options={ 'abstract': False, @@ -56,7 +56,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='alias', name='domain', - field=models.ForeignKey(to='dpdapi.Domain'), + field=models.ForeignKey(to='dpdapi.Domain', on_delete=models.CASCADE), preserve_default=True, ), ] diff --git a/dpdapi/models.py b/dpdapi/models.py index 2447983..2a027f5 100644 --- a/dpdapi/models.py +++ b/dpdapi/models.py @@ -12,7 +12,7 @@ class BaseModel(models.Model): class Alias(BaseModel): source = models.EmailField(max_length=254) destination = models.EmailField(max_length=254) - domain = models.ForeignKey('dpdapi.Domain') + domain = models.ForeignKey('dpdapi.Domain', models.CASCADE) active = models.BooleanField(default=True) def __str__(self): @@ -44,7 +44,7 @@ class Domain(BaseModel): class User(BaseModel): email = models.EmailField(max_length=254, unique=True) password = models.CharField(max_length=109) - domain = models.ForeignKey('dpdapi.Domain') + domain = models.ForeignKey('dpdapi.Domain', models.CASCADE) def __str__(self): return self.email diff --git a/requirements.txt b/requirements.txt index c0b1fea..76e23e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -Django==1.11.11 +Django==2.0.3 django-extensions==2.0.6 django-filter==1.1.0 djangorestframework==3.7.7