Implement custom notification settings

This commit is contained in:
2022-12-18 17:21:52 +00:00
parent 4c463e88f2
commit 7ee698f457
9 changed files with 141 additions and 8 deletions

View File

@@ -3,7 +3,16 @@ from django.contrib.auth.forms import UserCreationForm
from django.core.exceptions import FieldDoesNotExist
from django.forms import ModelForm
from .models import Account, Hook, Signal, Strategy, Trade, TradingTime, User
from .models import (
Account,
Hook,
NotificationSettings,
Signal,
Strategy,
Trade,
TradingTime,
User,
)
# flake8: noqa: E501
@@ -276,3 +285,16 @@ class TradingTimeForm(RestrictedFormMixin, ModelForm):
"end_day": "The day of the week to stop trading.",
"end_time": "The time of day to stop trading.",
}
class NotificationSettingsForm(RestrictedFormMixin, ModelForm):
class Meta:
model = NotificationSettings
fields = (
"ntfy_topic",
"ntfy_url",
)
help_texts = {
"ntfy_topic": "The topic to send notifications to.",
"ntfy_url": "Custom NTFY server. Leave blank to use the default server.",
}