def page(request):
return render(
request,
'page.html', {
'val': reverse('value_url'),
}
)
<input name="val_name" value="{{ val }}" type="hidden">
<script src="script.js"></script>
const value = document.querySelector('[name=val_name]').value;
<script type="text/javascript">
if (history.pushState) {
var baseUrl = window.location.protocol + "//" + window.location.host + window.location.pathname;
var newUrl = baseUrl + `?cat={{ cat_id_join }}{% if tag.0 != "" %}&tag={{ tagstr_param }}{% endif %}&page={{ page }}&size={{ size }}&order={{ order }}&direction={{ direction }}`;
history.replaceState(null, null, newUrl);
}
</script>
<script type="text/javascript">
function catSelect(event) {
var cat_id = $(event.currentTarget).attr('cat_id');
if (event.ctrlKey) {
window.location.href = "/publication/?cat={{ cat_id_join }}," + cat_id + "{% if tag.0 != "" %}&tag={{ tagstr_param }}{% endif %}&page=1&size={{ size }}&order={{ order }}&direction={{ direction }}"
return;
}
if (event.altKey) {
window.location.href = "/publication/?cat={{ cat_id_join }}," + cat_id + "(del){% if tag.0 != "" %}&tag={{ tagstr_param }}{% endif %}&page=1&size={{ size }}&order={{ order }}&direction={{ direction }}"
return;
}
window.location.href = "/publication/?cat=" + cat_id + "&page=1&size={{ size }}&order={{ order }}&direction={{ direction }}"
}
</script>