Add all models to admin site and tweak some documentation

This commit is contained in:
Mark Veidemanis 2023-02-10 23:47:55 +00:00
parent 010aba7f81
commit 1f43a00c7a
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 23 additions and 1 deletions

View File

@ -13,6 +13,10 @@ from .models import (
Trade, Trade,
TradingTime, TradingTime,
User, User,
NotificationSettings,
RiskModel,
AssetGroup,
AssetRestriction,
) )
# admin.site.__class__ = OTPAdminSite # admin.site.__class__ = OTPAdminSite
@ -73,6 +77,18 @@ class StrategyAdmin(admin.ModelAdmin):
list_display = ("user", "name", "description", "account", "enabled") list_display = ("user", "name", "description", "account", "enabled")
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")
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(User, CustomUserAdmin)
admin.site.register(Plan) admin.site.register(Plan)
admin.site.register(Session) admin.site.register(Session)
@ -84,3 +100,7 @@ admin.site.register(Trade, TradeAdmin)
admin.site.register(Callback, CallbackAdmin) admin.site.register(Callback, CallbackAdmin)
admin.site.register(TradingTime, TradingTimeAdmin) admin.site.register(TradingTime, TradingTimeAdmin)
admin.site.register(Strategy, StrategyAdmin) 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)

View File

@ -18,7 +18,8 @@ log = logs.get_logger(__name__)
class AssetGroupList(LoginRequiredMixin, ObjectList): class AssetGroupList(LoginRequiredMixin, ObjectList):
list_template = "partials/assetgroup-list.html" list_template = "partials/assetgroup-list.html"
model = AssetGroup model = AssetGroup
page_title = "List of asset groups for restrictions. Linked to accounts." page_title = "List of asset groups for restrictions. Linked to strategies."
page_subtitle = "Asset groups are collections of asset restrictions."
list_url_name = "assetgroups" list_url_name = "assetgroups"
list_url_args = ["type"] list_url_args = ["type"]
@ -64,6 +65,7 @@ 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."
list_url_name = "assetrestrictions" list_url_name = "assetrestrictions"
list_url_args = ["type", "group"] list_url_args = ["type", "group"]