[UPDT] HORILLA VIEWS: getattr method
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -93,4 +93,3 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user