Привязка каналов к вызову
This commit is contained in:
parent
ad6c12b547
commit
2eeeefb26f
@ -1,6 +1,7 @@
|
||||
from django.db import models
|
||||
|
||||
from apps.pla.models.model_alarm import Alarm
|
||||
from apps.pla.models.model_channel import PlaChannel
|
||||
|
||||
|
||||
class VoiceCall(models.Model):
|
||||
@ -8,6 +9,7 @@ class VoiceCall(models.Model):
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
sent = models.BooleanField(default=False)
|
||||
alarm_file = models.ForeignKey(Alarm, on_delete=models.CASCADE)
|
||||
channels = models.ManyToManyField(PlaChannel)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.created_at}"
|
||||
|
||||
@ -21,6 +21,8 @@ from sabron.util import logging
|
||||
|
||||
def start_call(request, alarm):
|
||||
call = VoiceCall.objects.create(alarm_file=alarm)
|
||||
active_channels = PlaChannel.objects.filter(active=True)
|
||||
call.channels.add(*active_channels)
|
||||
return redirect("/pla/")
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user