This commit is contained in:
Mark Veidemanis 2023-02-11 14:00:19 +00:00
parent 57078c10c1
commit 8455d64e31
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
3 changed files with 24 additions and 9 deletions

View File

@ -4,19 +4,19 @@ from django.contrib.auth.admin import UserAdmin
from .forms import CustomUserCreationForm from .forms import CustomUserCreationForm
from .models import ( from .models import (
Account, Account,
AssetGroup,
AssetRestriction,
Callback, Callback,
Hook, Hook,
NotificationSettings,
Plan, Plan,
RiskModel,
Session, Session,
Signal, Signal,
Strategy, Strategy,
Trade, Trade,
TradingTime, TradingTime,
User, User,
NotificationSettings,
RiskModel,
AssetGroup,
AssetRestriction,
) )
# admin.site.__class__ = OTPAdminSite # admin.site.__class__ = OTPAdminSite
@ -80,15 +80,27 @@ class StrategyAdmin(admin.ModelAdmin):
class NotificationSettingsAdmin(admin.ModelAdmin): class NotificationSettingsAdmin(admin.ModelAdmin):
list_display = ("user", "ntfy_topic", "ntfy_url") list_display = ("user", "ntfy_topic", "ntfy_url")
class RiskModelAdmin(admin.ModelAdmin): class RiskModelAdmin(admin.ModelAdmin):
list_display = ("user", "name", "description", "max_loss_percent", "max_risk_percent", "max_open_trades", "max_open_trades_per_symbol") list_display = (
"user",
"name",
"description",
"max_loss_percent",
"max_risk_percent",
"max_open_trades",
"max_open_trades_per_symbol",
)
class AssetGroupAdmin(admin.ModelAdmin): class AssetGroupAdmin(admin.ModelAdmin):
list_display = ("user", "name", "description", "account") list_display = ("user", "name", "description", "account")
class AssetRestrictionAdmin(admin.ModelAdmin): class AssetRestrictionAdmin(admin.ModelAdmin):
list_display = ("user", "name", "description", "webhook_id", "group") list_display = ("user", "name", "description", "webhook_id", "group")
admin.site.register(User, CustomUserAdmin) admin.site.register(User, CustomUserAdmin)
admin.site.register(Plan) admin.site.register(Plan)
admin.site.register(Session) admin.site.register(Session)

View File

@ -1,7 +1,7 @@
# Generated by Django 4.1.6 on 2023-02-10 22:57 # Generated by Django 4.1.6 on 2023-02-10 22:57
from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View File

@ -1,3 +1,5 @@
import json
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse from django.http import HttpResponse
from mixins.views import AbortSave, ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate from mixins.views import AbortSave, ObjectCreate, ObjectDelete, ObjectList, ObjectUpdate
@ -8,7 +10,6 @@ from rest_framework.views import APIView
from core.forms import AssetGroupForm, AssetRestrictionForm from core.forms import AssetGroupForm, AssetRestrictionForm
from core.models import AssetGroup, AssetRestriction from core.models import AssetGroup, AssetRestriction
from core.util import logs from core.util import logs
import json
log = logs.get_logger(__name__) log = logs.get_logger(__name__)
@ -65,7 +66,9 @@ class AssetRestrictionList(
list_template = "partials/assetrestriction-list.html" list_template = "partials/assetrestriction-list.html"
model = AssetRestriction model = AssetRestriction
page_title = "List of asset restrictions. Linked to asset groups." page_title = "List of asset restrictions. Linked to asset groups."
page_subtitle = "Allows API calls to permit or prohibit trading on defined currency pairs." page_subtitle = (
"Allows API calls to permit or prohibit trading on defined currency pairs."
)
list_url_name = "assetrestrictions" list_url_name = "assetrestrictions"
list_url_args = ["type", "group"] list_url_args = ["type", "group"]