def i_render_ff(request): """ Will provide inclusion data of the export UI for the frontend. """ valid_user = token_checker.token_is_valid(request) if valid_user: return dashboard_includer.get_as_json("final_fusion/_export.html")
def i_render_new_project(request): """ Will return content to render the landing page UI of a project (where you can create notes). """ valid_user = token_checker.token_is_valid(request) if valid_user: return dashboard_includer.get_as_json("project/_new_project.html")
def i_render_user_projects(request): """ Will provide content for project UI inclusion. Will count added TQs and rule modules to pass them for display. """ valid_user = token_checker.token_is_valid(request) dic = {} if valid_user: projects = list(Project.objects.filter(user_profile=valid_user, archived=False).order_by("pk")) projects.extend(Project.objects.filter(shared=True, archived=False).order_by("pk")) project_list = [] for p in projects: ff = FinalFusion.objects.get(project=p) rm_count = len(RuleModule.objects.filter(final_fusion=ff, archived=False)) rm_count += len(ScriptModule.objects.filter(final_fusion=ff, archived=False)) project_list.append({ "id": p.pk, "name": p.name, "tq_len": len(TQFile.objects.filter(project=p, archived=False)), "rm_len": rm_count, "date": "Erstellt am %s" % p.creation_date.strftime('%d.%m.%Y'), }) dic["projects"] = project_list return dashboard_includer.get_as_json("project/_user_projects.html", template_context=dic)
def i_render_settings(request): """ i_render_settings """ valid_user = token_checker.token_is_valid(request) if valid_user: return dashboard_includer.get_as_json("user_profile/_settings.html", different_js="_user_settings.js")
def i_render_import(request): """ Will render the import page for TQs by inclusion. """ valid_user = token_checker.token_is_valid(request) if valid_user: dic = {"csrf_token": get_csrf_token(request)} return dashboard_includer.get_as_json("tq_file/_import.html", template_context=dic)
def i_render_single_tq(request): """ Will render a single TQ with its metadata by inclusion. """ valid_user = token_checker.token_is_valid(request) if valid_user and "id" in request.GET and ArgsChecker.is_number( request.GET["id"]): tq = TQFile.objects.get(pk=request.GET["id"], archived=False) dic = { "id": tq.pk, "name": tq.display_file_name, "created": tq.creation_date.strftime('%d.%m.%Y') } return dashboard_includer.get_as_json("tq_file/_view.html", template_context=dic)