Move type field to signal

This commit is contained in:
2022-12-07 07:20:11 +00:00
parent 2ee5f7b937
commit e388624f65
3 changed files with 30 additions and 7 deletions

View File

@@ -35,7 +35,7 @@ DAY_CHOICES = (
(6, "Saturday"),
(7, "Sunday"),
)
HOOK_TYPE_CHOICES = (
SIGNAL_TYPE_CHOICES = (
("entry", "Entry"),
("exit", "Exit"),
("trend", "Trend"),
@@ -174,7 +174,6 @@ class Hook(models.Model):
name = models.CharField(max_length=1024)
hook = models.CharField(max_length=255, unique=True) # hook URL
received = models.IntegerField(default=0)
type = models.CharField(choices=HOOK_TYPE_CHOICES, max_length=255)
def __str__(self):
return f"{self.name} ({self.hook})"
@@ -187,6 +186,7 @@ class Signal(models.Model):
hook = models.ForeignKey(Hook, on_delete=models.CASCADE)
direction = models.CharField(choices=DIRECTION_CHOICES, max_length=255)
received = models.IntegerField(default=0)
type = models.CharField(choices=SIGNAL_TYPE_CHOICES, max_length=255)
def __str__(self):
return f"{self.name} ({self.hook.name}) - {self.direction}"