.
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% json_script leaves as worker_leaves_json %}
|
<script id="worker_leaves_json" type="application/json">{{ leaves_json|safe }}</script>
|
||||||
<script src="{% static 'js/calendar.js' %}"></script>
|
<script src="{% static 'js/calendar.js' %}"></script>
|
||||||
<script>
|
<script>
|
||||||
(function(){
|
(function(){
|
||||||
|
|||||||
@@ -336,7 +336,13 @@ def worker_detail(request, worker_id):
|
|||||||
except Exception:
|
except Exception:
|
||||||
leaves = []
|
leaves = []
|
||||||
|
|
||||||
return render(request, "rota/worker_detail.html", {"worker": worker, "form": form, "leaves": leaves})
|
# Provide a JSON-encoded string for safe embedding in the template
|
||||||
|
try:
|
||||||
|
leaves_json = json.dumps(leaves)
|
||||||
|
except Exception:
|
||||||
|
leaves_json = '[]'
|
||||||
|
|
||||||
|
return render(request, "rota/worker_detail.html", {"worker": worker, "form": form, "leaves": leaves, "leaves_json": leaves_json})
|
||||||
|
|
||||||
|
|
||||||
@require_http_methods(["GET", "POST"])
|
@require_http_methods(["GET", "POST"])
|
||||||
|
|||||||
Reference in New Issue
Block a user