diff --git a/app/settings.py b/app/settings.py index f88a7e1..9fc1aac 100644 --- a/app/settings.py +++ b/app/settings.py @@ -68,6 +68,9 @@ CACHES = { }, } } +# CACHE_MIDDLEWARE_ALIAS = 'default' +# CACHE_MIDDLEWARE_SECONDS = '600' +# CACHE_MIDDLEWARE_KEY_PREFIX = '' CRISPY_TEMPLATE_PACK = "bulma" CRISPY_ALLOWED_TEMPLATE_PACKS = ("bulma",) @@ -77,16 +80,15 @@ MIDDLEWARE = [ "debug_toolbar.middleware.DebugToolbarMiddleware", "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", + # 'django.middleware.cache.UpdateCacheMiddleware', "django.middleware.common.CommonMiddleware", + # 'django.middleware.cache.FetchFromCacheMiddleware', "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django_otp.middleware.OTPMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "django_htmx.middleware.HtmxMiddleware", - # 'django.middleware.cache.UpdateCacheMiddleware', - # 'django.middleware.common.CommonMiddleware', - # 'django.middleware.cache.FetchFromCacheMiddleware', ] ROOT_URLCONF = "app.urls" diff --git a/core/templates/partials/account-list.html b/core/templates/partials/account-list.html index 45d0b82..348dedd 100644 --- a/core/templates/partials/account-list.html +++ b/core/templates/partials/account-list.html @@ -1,112 +1,114 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - - - -
idusernameexchangecurrencyinitialAPI keysandboxenabledactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.exchange }}{{ item.currency }}{{ item.initial_balance }}{{ item.api_key }} - {% if item.sandbox %} - - - - {% else %} - - - - {% endif %} - - {% if item.enabled %} - - - - {% else %} - - - - {% endif %} - -
-
+{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/assetgroup-list.html b/core/templates/partials/assetgroup-list.html index d3a2f72..71ffbf2 100644 --- a/core/templates/partials/assetgroup-list.html +++ b/core/templates/partials/assetgroup-list.html @@ -1,72 +1,74 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} +{% cache 600 objects_assetgroups request.user.id object_list %} + + + + + + + + + + + + {% for item in object_list %} + + + + + + + + + + + {% endfor %} -
idusernamedescriptionaccountstatusrestrictionsactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.description }}{{ item.account }}{{ item.matches }}{{ item.restrictions }} +
+ + + + +
+
- - - - - - - - - - - {% for item in object_list %} - - - - - - - - - - - {% endfor %} - -
idusernamedescriptionaccountstatusrestrictionsactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.description }}{{ item.account }}{{ item.matches }}{{ item.restrictions }} -
- - - - -
-
+ +{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/assetrestriction-list.html b/core/templates/partials/assetrestriction-list.html index 32e753c..d47c813 100644 --- a/core/templates/partials/assetrestriction-list.html +++ b/core/templates/partials/assetrestriction-list.html @@ -1,71 +1,73 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - -
idusernamedescriptionpairsgrouphookactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.description }}{{ item.pairs_parsed|length }}{{ item.group }} - - - - - - -
-
+{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/callback-list.html b/core/templates/partials/callback-list.html index 818b8c1..6ce48e1 100644 --- a/core/templates/partials/callback-list.html +++ b/core/templates/partials/callback-list.html @@ -1,50 +1,52 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} +{% cache 600 objects_callbacks request.user.id object_list %} + + + + + + + + + + + + + + + + + {% for item in object_list %} + + + + + + + + + + + + + -
idhook idhook nametitlemessageperiodsenttradeexchangesymbolpricecontractactions
{{ item.id }}{{ item.hook.id }} + {{ item.hook.name }} + + {{ item.title }}{{ item.message }}{{ item.period }}{{ item.sent }}{{ item.trade }}{{ item.exchange }}{{ item.symbol }}{{ item.price }}{{ item.contract }}
- - - - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - - - - - - + + + {% endfor %} - - - - {% endfor %} - -
idhook idhook nametitlemessageperiodsenttradeexchangesymbolpricecontractactions
{{ item.id }}{{ item.hook.id }} - {{ item.hook.name }} - - {{ item.title }}{{ item.message }}{{ item.period }}{{ item.sent }}{{ item.trade }}{{ item.exchange }}{{ item.symbol }}{{ item.price }}{{ item.contract }} +
-
-
+
+
+ +{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/hook-list.html b/core/templates/partials/hook-list.html index 52d4907..7650b5f 100644 --- a/core/templates/partials/hook-list.html +++ b/core/templates/partials/hook-list.html @@ -1,92 +1,94 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - {% for item in object_list %} - - - - - - -
idusernamehookreceived hooksactions
{{ item.id }}{{ item.user }}{{ item.name }} - - - - - - {{ item.received }} -
-
+{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/position-detail.html b/core/templates/partials/position-detail.html index 4452a50..d81ec53 100644 --- a/core/templates/partials/position-detail.html +++ b/core/templates/partials/position-detail.html @@ -1,33 +1,36 @@ {% extends 'partials/generic-detail.html' %} +{% load cache %} {% block tbody %} - {% for key, item in object.items %} - - {% if key == 'trade_ids' %} - {{ key }} - - {% if item is not None %} - {% for trade_id in item %} - - {% endfor %} - {% endif %} - - {% else %} - {{ key }} - - {% if item is not None %} - {{ item }} - {% endif %} - - {% endif %} - - {% endfor %} + {% cache 600 object_position_detail request.user.id object %} + {% for key, item in object.items %} + + {% if key == 'trade_ids' %} + {{ key }} + + {% if item is not None %} + {% for trade_id in item %} + + {% endfor %} + {% endif %} + + {% else %} + {{ key }} + + {% if item is not None %} + {{ item }} + {% endif %} + + {% endif %} + + {% endfor %} + {% endcache %} {% endblock %} \ No newline at end of file diff --git a/core/templates/partials/position-list.html b/core/templates/partials/position-list.html index 8574e94..a88e7f8 100644 --- a/core/templates/partials/position-list.html +++ b/core/templates/partials/position-list.html @@ -1,76 +1,93 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - - - + + - - {% endfor %} + {% endif %} + + + + {% endfor %} -
accountassetpriceunitsquoteP/Lsidetradesactions
{{ item.account }}{{ item.symbol }}{{ item.price }}{{ item.units }}{{ item.value }}{{ item.unrealized_pl }} - {% if item.side == 'long' %} - - - - {% elif item.side == 'short' %} - - - - {% endif %} - {{ item.trade_ids|length }} -
- - - {% if type == 'page' %} - + {% endif %} +
{{ item.trade_ids|length }} +
+ + + {% if type == 'page' %} + + + + {% else %} - - {% else %} - - {% endif %} -
-
+ +{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/product-list.html b/core/templates/partials/product-list.html index a35839e..c3127c0 100644 --- a/core/templates/partials/product-list.html +++ b/core/templates/partials/product-list.html @@ -1,48 +1,49 @@ {% load static %} +{% load cache %} -{% for plan in plans %} +{% cache 600 objects_plans request.user.id plans %} - -
-
-
-
- Image -
-
-
-
-

- {{ plan.name }} £{{ plan.cost }} - {% if plan in user_plans %} - - {% endif %} -
- {{ plan.description }} -

+ {% for plan in plans %} +
+
+
+
+ Image +
- -
-
-
-{% endfor %} + + + + + {% endfor %} +{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/profit-list.html b/core/templates/partials/profit-list.html index 8c7ead8..b11c353 100644 --- a/core/templates/partials/profit-list.html +++ b/core/templates/partials/profit-list.html @@ -1,32 +1,34 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} +{% cache 600 objects_profit request.user.id object_list %} + + + + + + + + + + {% for item in object_list %} + + + + + + + + + {% endfor %} -
idnameP/Ltradebalancecurrency
{{ item.account.id }}{{ item.account.name }}{{ item.pl }}{{ item.unrealizedPL }}{{ item.balance }}{{ item.currency }}
- - - - - - - - - {% for item in object_list %} - - - - - - - - - {% endfor %} - -
idnameP/Ltradebalancecurrency
{{ item.account.id }}{{ item.account.name }}{{ item.pl }}{{ item.unrealizedPL }}{{ item.balance }}{{ item.currency }}
+ +{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/risk-list.html b/core/templates/partials/risk-list.html index bbf3160..d447c67 100644 --- a/core/templates/partials/risk-list.html +++ b/core/templates/partials/risk-list.html @@ -1,65 +1,67 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - - -
idusernamedescriptionmax loss percentmax risk percentmax open tradesmax open trades per symbolactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.description }}{{ item.max_loss_percent }}{{ item.max_risk_percent }}{{ item.max_open_trades }}{{ item.max_open_trades_per_symbol }} -
-
+{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/signal-list.html b/core/templates/partials/signal-list.html index 00ef265..938cb0d 100644 --- a/core/templates/partials/signal-list.html +++ b/core/templates/partials/signal-list.html @@ -1,99 +1,101 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - - + + + + + + + + + + {% for item in object_list %} + + + + + + + + + - - {% endfor %} + + {% if type == 'page' %} + + + {% else %} + + {% endif %} + + + + {% endfor %} -
idusernamesignalhookdirectionreceived hooksactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.signal }} - {{ item.hook.name }} - - {{ item.direction }}{{ item.received }} -
-
idusernamesignalhookdirectionreceived hooksactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.signal }} + - - - - - - - - {% if type == 'page' %} - - - {% else %} + hx-swap="innerHTML">{{ item.hook.name }} + + {{ item.direction }}{{ item.received }} +
- {% endif %} -
-
+ +{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/strategy-list.html b/core/templates/partials/strategy-list.html index a29c4f9..efe3e04 100644 --- a/core/templates/partials/strategy-list.html +++ b/core/templates/partials/strategy-list.html @@ -1,98 +1,100 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - -
idnamedescriptionaccountenabledTPSLactions
{{ item.id }}{{ item.name }}{{ item.description|truncatechars:80 }}{{ item.account }} - {% if item.enabled %} - - - - {% else %} - - - - {% endif %} - {{ item.take_profit_percent }}{{ item.stop_loss_percent }} -
-
+{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/trade-list.html b/core/templates/partials/trade-list.html index 98806fd..6254978 100644 --- a/core/templates/partials/trade-list.html +++ b/core/templates/partials/trade-list.html @@ -1,66 +1,82 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - - - - {% for item in object_list %} - - - - - - - - - - -
idstatusaccount idsymboltypeamountpriceSLTLactions
{{ item.id }}{{ item.status }}{{ item.account.id }}{{ item.symbol }}{{ item.type }}{{ item.amount }}{{ item.price }}{{ item.stop_loss }}{{ item.take_profit }} -
-
+{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/trading-time-list.html b/core/templates/partials/trading-time-list.html index 198ed9e..c637201 100644 --- a/core/templates/partials/trading-time-list.html +++ b/core/templates/partials/trading-time-list.html @@ -1,61 +1,63 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - - - - - {% for item in object_list %} - - - - - - - -
idusernamedescriptionstartendactions
{{ item.id }}{{ item.user }}{{ item.name }}{{ item.description }}{{ item.get_start_day_display }} at {{ item.start_time }}{{ item.get_end_day_display }} at {{ item.end_time }} -
-
+{% endcache %} \ No newline at end of file diff --git a/core/templates/partials/trend-direction-list.html b/core/templates/partials/trend-direction-list.html index ae5acc8..349770b 100644 --- a/core/templates/partials/trend-direction-list.html +++ b/core/templates/partials/trend-direction-list.html @@ -1,55 +1,57 @@ +{% load cache %} {% include 'mixins/partials/notify.html' %} - - - - - - - - {% for key, item in object_list.items %} - - - -
symboldirectionactions
{{ key }}{{ item }} -
-
+{% endcache %} \ No newline at end of file