Make notification rule ID field UUID and fix default sources
This commit is contained in:
parent
97e932cbae
commit
79b4512546
|
@ -300,7 +300,7 @@ class ElasticsearchBackend(StorageBackend):
|
|||
search_query,
|
||||
index=index,
|
||||
)
|
||||
# self.log.debug(f"Running scheduled query on {index}: {search_query}")
|
||||
self.log.debug(f"Running scheduled query on {index}: {search_query}")
|
||||
# self.log.debug(f"Response from scheduled query: {response}")
|
||||
if isinstance(response, Exception):
|
||||
error = response.info["error"]["root_cause"][0]["reason"]
|
||||
|
|
|
@ -564,7 +564,7 @@ class NotificationRuleData(object):
|
|||
else:
|
||||
# Get the default value for the user if not present
|
||||
source = parse_source(self.user, {}, raise_error=True)
|
||||
self.parsed["source"] = [source]
|
||||
self.parsed["source"] = source
|
||||
|
||||
def parse_data(self):
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 4.1.5 on 2023-02-02 19:08
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0023_alter_perms_options'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='notificationrule',
|
||||
name='id',
|
||||
field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 4.1.5 on 2023-02-02 19:35
|
||||
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('core', '0024_alter_notificationrule_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='notificationrule',
|
||||
name='id',
|
||||
field=models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True),
|
||||
),
|
||||
]
|
|
@ -1,4 +1,5 @@
|
|||
import logging
|
||||
import uuid
|
||||
|
||||
import stripe
|
||||
from django.conf import settings
|
||||
|
@ -175,6 +176,9 @@ class Perms(models.Model):
|
|||
|
||||
|
||||
class NotificationRule(models.Model):
|
||||
id = models.UUIDField(
|
||||
default=uuid.uuid4, primary_key=True, editable=False, unique=True
|
||||
)
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=255)
|
||||
priority = models.IntegerField(choices=PRIORITY_CHOICES, default=1)
|
||||
|
|
Loading…
Reference in New Issue