diff options
Diffstat (limited to 'ishtar_common/views_item.py')
| -rw-r--r-- | ishtar_common/views_item.py | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 25ffe582e..8c1c0b734 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -170,7 +170,8 @@ def check_permission(request, action_slug, obj_id=None):  def new_qa_item( -    model, frm, many=False, template="ishtar/forms/qa_new_item.html", page_name="" +    model, frm, many=False, template="ishtar/forms/qa_new_item.html", page_name="", +    callback=None  ):      def func(request, parent_name, limits=""):          model_name = model._meta.object_name @@ -204,6 +205,8 @@ def new_qa_item(                  if dct["parent_pk"] and "_select_" in dct["parent_pk"]:                      parents = dct["parent_pk"].split("_")                      dct["parent_pk"] = "_".join([parents[0]] + parents[2:]) +                if callback: +                    callback("new_qa_item", request, None, model.objects.filter(pk=new_item.pk))                  return render(request, template, dct)          else:              dct["form"] = frm(limits=limits) @@ -228,7 +231,7 @@ def get_short_html_detail(model):      return func -def modify_qa_item(model, frm): +def modify_qa_item(model, frm, callback=None):      def func(request, parent_name="", pk=None):          template = "ishtar/forms/qa_new_item.html"          model_name = model._meta.object_name @@ -263,6 +266,8 @@ def modify_qa_item(model, frm):                  if dct["parent_pk"] and "_select_" in dct["parent_pk"]:                      parents = dct["parent_pk"].split("_")                      dct["parent_pk"] = "_".join([parents[0]] + parents[2:]) +                if callback: +                    callback("modify_qa_item", request, None, model.objects.filter(pk=new_item.pk))                  return render(request, template, dct)          else:              data = model_to_dict(item) | 
