From 8455d64e311031beecc1165a941d12d92bfc08c6 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 11 Feb 2023 14:00:19 +0000 Subject: [PATCH] Reformat --- core/admin.py | 24 +++++++++++++++----- core/migrations/0055_strategy_asset_group.py | 2 +- core/views/assets.py | 7 ++++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/core/admin.py b/core/admin.py index 1165a4d..34524ee 100644 --- a/core/admin.py +++ b/core/admin.py @@ -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) \ No newline at end of file +admin.site.register(AssetRestriction, AssetRestrictionAdmin) diff --git a/core/migrations/0055_strategy_asset_group.py b/core/migrations/0055_strategy_asset_group.py index 991fe1a..dc3aed6 100644 --- a/core/migrations/0055_strategy_asset_group.py +++ b/core/migrations/0055_strategy_asset_group.py @@ -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): diff --git a/core/views/assets.py b/core/views/assets.py index 391b2ec..3047385 100644 --- a/core/views/assets.py +++ b/core/views/assets.py @@ -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"]