2023-10-26 12:51:28 +05:30
|
|
|
"""
|
|
|
|
|
context_processor.py
|
|
|
|
|
|
|
|
|
|
This module is used to register context processor`
|
|
|
|
|
"""
|
2024-03-10 19:37:46 +05:30
|
|
|
|
2023-10-26 12:51:28 +05:30
|
|
|
from django.http import JsonResponse
|
2024-05-07 12:23:36 +05:30
|
|
|
from django.urls import include, path
|
|
|
|
|
|
|
|
|
|
from horilla.urls import urlpatterns
|
2023-10-26 12:51:28 +05:30
|
|
|
from horilla_audit.forms import HistoryForm
|
|
|
|
|
from horilla_audit.models import AuditTag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def history_form(request):
|
|
|
|
|
"""
|
|
|
|
|
This method will return the history additional field form
|
|
|
|
|
"""
|
|
|
|
|
form = HistoryForm()
|
|
|
|
|
return {"history_form": form}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dynamic_tag(request):
|
|
|
|
|
"""
|
|
|
|
|
This method is used to dynamically create history tags
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
title = request.POST["title"]
|
|
|
|
|
title = AuditTag.objects.get_or_create(title=title)
|
|
|
|
|
return JsonResponse({"id": title[0].id})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
urlpatterns.append(path("horilla-audit-log", dynamic_tag, name="horilla-audit-log"))
|