2020-12-10 12:50:22 +00:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
from django.db import models
|
2023-07-24 03:52:25 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2022-12-20 12:23:42 +00:00
|
|
|
|
|
|
|
from common.db.models import JMSBaseModel
|
2023-08-01 08:40:38 +00:00
|
|
|
from terminal.const import TaskNameType as SessionTaskChoices
|
2020-12-10 12:50:22 +00:00
|
|
|
from .terminal import Terminal
|
|
|
|
|
|
|
|
|
2022-12-20 12:23:42 +00:00
|
|
|
class Task(JMSBaseModel):
|
2020-12-10 12:50:22 +00:00
|
|
|
|
2023-08-01 08:40:38 +00:00
|
|
|
name = models.CharField(max_length=128, choices=SessionTaskChoices.choices, verbose_name=_("Name"))
|
2020-12-10 12:50:22 +00:00
|
|
|
args = models.CharField(max_length=1024, verbose_name=_("Args"))
|
2021-07-29 06:53:04 +00:00
|
|
|
kwargs = models.JSONField(default=dict, verbose_name=_("Kwargs"))
|
2020-12-10 12:50:22 +00:00
|
|
|
terminal = models.ForeignKey(Terminal, null=True, on_delete=models.SET_NULL)
|
|
|
|
is_finished = models.BooleanField(default=False)
|
|
|
|
date_finished = models.DateTimeField(null=True)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
db_table = "terminal_task"
|
2022-02-17 12:13:31 +00:00
|
|
|
verbose_name = _("Task")
|