From d6ab0ffd0eba3fc509d46c3104a3e9a252765b11 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 12 Dec 2022 07:20:20 +0000 Subject: [PATCH] Add all models to admin site --- core/admin.py | 49 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/core/admin.py b/core/admin.py index 2dff02f..55bcde4 100644 --- a/core/admin.py +++ b/core/admin.py @@ -2,7 +2,18 @@ from django.contrib import admin from django.contrib.auth.admin import UserAdmin from .forms import CustomUserCreationForm -from .models import Plan, Session, User +from .models import ( + Account, + Callback, + Hook, + Plan, + Session, + Signal, + Strategy, + Trade, + TradingTime, + User, +) # admin.site.__class__ = OTPAdminSite @@ -34,6 +45,42 @@ class CustomUserAdmin(UserAdmin): ) +class AccountAdmin(admin.ModelAdmin): + list_display = ("user", "name", "exchange", "sandbox", "currency") + + +class HookAdmin(admin.ModelAdmin): + list_display = ("user", "name", "hook", "received") + + +class SignalAdmin(admin.ModelAdmin): + list_display = ("user", "name", "signal", "hook", "direction", "received", "type") + + +class TradeAdmin(admin.ModelAdmin): + list_display = ("user", "account", "symbol", "amount", "direction", "status") + + +class CallbackAdmin(admin.ModelAdmin): + list_display = ("hook", "signal", "title", "symbol", "price") + + +class TradingTimeAdmin(admin.ModelAdmin): + list_display = ("user", "name", "start_day", "start_time", "end_day", "end_time") + + +class StrategyAdmin(admin.ModelAdmin): + list_display = ("user", "name", "description", "account", "enabled") + + admin.site.register(User, CustomUserAdmin) admin.site.register(Plan) admin.site.register(Session) + +admin.site.register(Account, AccountAdmin) +admin.site.register(Hook, HookAdmin) +admin.site.register(Signal, SignalAdmin) +admin.site.register(Trade, TradeAdmin) +admin.site.register(Callback, CallbackAdmin) +admin.site.register(TradingTime, TradingTimeAdmin) +admin.site.register(Strategy, StrategyAdmin)