Add all models to admin site

This commit is contained in:
Mark Veidemanis 2022-12-12 07:20:20 +00:00
parent 06d8c9f4b2
commit d6ab0ffd0e
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 48 additions and 1 deletions

View File

@ -2,7 +2,18 @@ from django.contrib import admin
from django.contrib.auth.admin import UserAdmin from django.contrib.auth.admin import UserAdmin
from .forms import CustomUserCreationForm 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 # 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(User, CustomUserAdmin)
admin.site.register(Plan) admin.site.register(Plan)
admin.site.register(Session) 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)