[UPDT] HORILLA VIEWS: getattr method

This commit is contained in:
Horilla
2025-04-28 10:31:12 +05:30
parent dbba4964ab
commit 9c454d21d1
3 changed files with 10 additions and 9 deletions

View File

@@ -2,15 +2,16 @@
horilla_views/generic/cbv/history.py
"""
from django.views.generic import DetailView
from django.contrib import messages
from django.apps import apps
from django.contrib import messages
from django.utils.decorators import method_decorator
from django.views.generic import DetailView
from simple_history.utils import get_history_model_for_model
from horilla_views.history_methods import get_diff
from horilla_views.generic.cbv.views import HorillaFormView
from horilla_views.cbv_methods import hx_request_required
from horilla.horilla_middlewares import _thread_locals
from horilla_views.cbv_methods import hx_request_required
from horilla_views.generic.cbv.views import HorillaFormView
from horilla_views.history_methods import get_diff
@method_decorator(hx_request_required, name="dispatch")

View File

@@ -57,7 +57,7 @@
}
})">
<ion-icon name="git-pull-request-outline"></ion-icon>
</a>
</a>
{% endif %}
{% endif %}
</span>
@@ -86,11 +86,10 @@
<h5 class="oh-404__subtitle mt-4 ml-2">{% trans 'No history found.' %}</h5>
</div>
</div>
{% comment %} <div class="d-flex justify-content-center align-items-center" style="height: 40vh">
<h5 class="oh-404__subtitle">{% trans 'No history found.' %}</h5>
</div> {% endcomment %}
{% endif %}
</div>
</div>

View File

@@ -6,6 +6,7 @@ This module is used to write custom template filters.
"""
import datetime
import functools
import re
import types
@@ -74,7 +75,7 @@ def getattribute(value, attr: str):
result.append(getattribute(record, attr))
elif hasattr(value, str(attr)):
result = getattr(value, attr)
if isinstance(result, types.MethodType):
if isinstance(result, (types.MethodType, functools.partial)):
result = result()
value = result
else: