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 .models import (
Account,
AssetGroup,
AssetRestriction,
Callback,
Hook,
NotificationSettings,
Plan,
RiskModel,
Session,
Signal,
Strategy,
Trade,
TradingTime,
User,
NotificationSettings,
RiskModel,
AssetGroup,
AssetRestriction,
)
# admin.site.__class__ = OTPAdminSite
@ -80,15 +80,27 @@ class StrategyAdmin(admin.ModelAdmin):
class NotificationSettingsAdmin(admin.ModelAdmin):
list_display = ("user", "ntfy_topic", "ntfy_url")
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):
list_display = ("user", "name", "description", "account")
class AssetRestrictionAdmin(admin.ModelAdmin):
list_display = ("user", "name", "description", "webhook_id", "group")
admin.site.register(User, CustomUserAdmin)
admin.site.register(Plan)
admin.site.register(Session)
@ -103,4 +115,4 @@ admin.site.register(Strategy, StrategyAdmin)
admin.site.register(NotificationSettings, NotificationSettingsAdmin)
admin.site.register(RiskModel, RiskModelAdmin)
admin.site.register(AssetGroup, AssetGroupAdmin)
admin.site.register(AssetRestriction, AssetRestrictionAdmin)
admin.site.register(AssetRestriction, AssetRestrictionAdmin)

View File

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

View File

@ -1,3 +1,5 @@
import json
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse
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.models import AssetGroup, AssetRestriction
from core.util import logs
import json
log = logs.get_logger(__name__)
@ -65,7 +66,9 @@ class AssetRestrictionList(
list_template = "partials/assetrestriction-list.html"
model = AssetRestriction
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_args = ["type", "group"]