diff --git a/apps/terminal/migrations/0027_auto_20201102_1651.py b/apps/terminal/migrations/0027_auto_20201102_1651.py new file mode 100644 index 000000000..5a328d84a --- /dev/null +++ b/apps/terminal/migrations/0027_auto_20201102_1651.py @@ -0,0 +1,19 @@ +# Generated by Django 2.2.13 on 2020-11-02 08:51 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('terminal', '0026_auto_20201027_1905'), + ] + + operations = [ + migrations.AlterField( + model_name='session', + name='terminal', + field=models.ForeignKey(db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='terminal.Terminal'), + ), + ] diff --git a/apps/terminal/models.py b/apps/terminal/models.py index a0f074b48..17c40e54b 100644 --- a/apps/terminal/models.py +++ b/apps/terminal/models.py @@ -198,7 +198,7 @@ class Session(OrgModelMixin): is_finished = models.BooleanField(default=False, db_index=True) has_replay = models.BooleanField(default=False, verbose_name=_("Replay")) has_command = models.BooleanField(default=False, verbose_name=_("Command")) - terminal = models.ForeignKey(Terminal, null=True, on_delete=models.SET_NULL) + terminal = models.ForeignKey(Terminal, null=True, on_delete=models.DO_NOTHING, db_constraint=False) protocol = models.CharField(choices=PROTOCOL.choices, default='ssh', max_length=16, db_index=True) date_start = models.DateTimeField(verbose_name=_("Date start"), db_index=True, default=timezone.now) date_end = models.DateTimeField(verbose_name=_("Date end"), null=True)