v1.3.6
This commit is contained in:
commit
8abcbfab0f
4 changed files with 80 additions and 0 deletions
26
engine/apps/alerts/migrations/0019_auto_20230705_1619.py
Normal file
26
engine/apps/alerts/migrations/0019_auto_20230705_1619.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Generated by Django 3.2.19 on 2023-07-05 16:19
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('user_management', '0011_auto_20230411_1358'),
|
||||
('slack', '0003_delete_slackactionrecord'),
|
||||
('alerts', '0018_remove_alertreceivechannel_integration_slack_channel_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='escalationpolicy',
|
||||
name='notify_to_group',
|
||||
field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='escalation_policies', to='slack.slackusergroup'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='escalationpolicy',
|
||||
name='notify_to_users_queue',
|
||||
field=models.ManyToManyField(related_name='escalation_policy_notify_queues', to='user_management.User'),
|
||||
),
|
||||
]
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Generated by Django 3.2.19 on 2023-07-05 16:19
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('user_management', '0011_auto_20230411_1358'),
|
||||
('auth_token', '0003_auto_20221121_1610'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='pluginauthtoken',
|
||||
name='organization',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plugin_auth_tokens', to='user_management.organization'),
|
||||
),
|
||||
]
|
||||
29
engine/apps/mobile_app/migrations/0009_fcmdevice.py
Normal file
29
engine/apps/mobile_app/migrations/0009_fcmdevice.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Generated by Django 3.2.19 on 2023-07-05 16:37
|
||||
|
||||
from django.db import migrations
|
||||
import django.db.models.manager
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('fcm_django', '0009_alter_fcmdevice_user'),
|
||||
('mobile_app', '0008_mobileappusersettings_locale'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='FCMDevice',
|
||||
fields=[
|
||||
],
|
||||
options={
|
||||
'proxy': True,
|
||||
'indexes': [],
|
||||
'constraints': [],
|
||||
},
|
||||
bases=('fcm_django.fcmdevice',),
|
||||
managers=[
|
||||
('active_objects', django.db.models.manager.Manager()),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
|
@ -29,6 +29,11 @@ class ActiveFCMDeviceQuerySet(models.QuerySet):
|
|||
class FCMDevice(BaseFCMDevice):
|
||||
active_objects = ActiveFCMDeviceQuerySet.as_manager()
|
||||
|
||||
class Meta:
|
||||
# don't create a table for this model..
|
||||
# https://docs.djangoproject.com/en/dev/topics/db/models/#differences-between-proxy-inheritance-and-unmanaged-models
|
||||
proxy = True
|
||||
|
||||
@classmethod
|
||||
def get_active_device_for_user(cls, user: "User") -> FCMDevice | None:
|
||||
return cls.active_objects.filter(user=user).first()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue