[UPDT] HORILLA VIEWS: getattr method
This commit is contained in:
@@ -2,15 +2,16 @@
|
|||||||
horilla_views/generic/cbv/history.py
|
horilla_views/generic/cbv/history.py
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from django.views.generic import DetailView
|
|
||||||
from django.contrib import messages
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
|
from django.contrib import messages
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.views.generic import DetailView
|
||||||
from simple_history.utils import get_history_model_for_model
|
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.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")
|
@method_decorator(hx_request_required, name="dispatch")
|
||||||
|
|||||||
@@ -93,4 +93,3 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -6,6 +6,7 @@ This module is used to write custom template filters.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import functools
|
||||||
import re
|
import re
|
||||||
import types
|
import types
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ def getattribute(value, attr: str):
|
|||||||
result.append(getattribute(record, attr))
|
result.append(getattribute(record, attr))
|
||||||
elif hasattr(value, str(attr)):
|
elif hasattr(value, str(attr)):
|
||||||
result = getattr(value, attr)
|
result = getattr(value, attr)
|
||||||
if isinstance(result, types.MethodType):
|
if isinstance(result, (types.MethodType, functools.partial)):
|
||||||
result = result()
|
result = result()
|
||||||
value = result
|
value = result
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user