知道为什么 paramquery 中的 pqgrid 不起作用吗?我尝试导入本地文件或链接在线文件,但仍然无法正常工作。我认为当我将文件加载到 django 项目中时这是一个问题,但我不知道为什么。有什么帮助吗?
这是HTML模板:
{% load static %}
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Django Girls</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<link href="https://unpkg.com/jquery-ui-pack@1.12.2/jquery-ui.css" rel="stylesheet" />
<link href="https://unpkg.com/jquery-ui-pack@1.12.2/jquery-ui.structure.css" rel="stylesheet" />
<link href="https://unpkg.com/jquery-ui-pack@1.12.2/jquery-ui.theme.css" rel="stylesheet" />
<script src="https://unpkg.com/jquery-ui-pack@1.12.2/jquery-ui.js"></script>
<link href="https://unpkg.com/pqgrid@8.1.1/pqgrid.min.css" rel="stylesheet" />
<link href="https://unpkg.com/pqgrid@8.1.1/pqgrid.ui.min.css" rel="stylesheet" />
<link href="https://unpkg.com/pqgrid@8.1.1/themes/steelblue/pqgrid.css" rel="stylesheet" />
<script src="https://unpkg.com/pqgrid@8.1.1/pqgrid.min.js"></script>
<script src="https://unpkg.com/pqgrid@8.1.1/localize/pq-localize-en.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<script src="https://unpkg.com/file-saver@2.0.1/dist/FileSaver.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="{% static 'css/blog.css' %}">
</head>
<body>
<div class="page-header">
{% if user.is_authenticated %}
<a href="{% url 'post_new' %}" class="top-menu"><span class="fa fa-plus" aria-hidden="true"></span></a>
<a href="{% url 'post_draft_list' %}" class="top-menu"><span class="fa fa-edit"></span></a>
<p class="top-menu">Hello {{ user.username }} <small>(<a href="{% url 'logout' %}">Log out</a>)</small></p>
{% else %}
<a href="{% url 'login' %}" class="top-menu"><span class="fa fa-lock"></span></a>
{% endif %}
<h1><a href="/">Django Girls Blog</a></h1>
</div>
<div class="content">
<div class="row">
<div class="col">
<div id="grid_json" style="margin:100px;"></div>
{% block content %}
{% endblock %}
</div>
</div>
</div>
</body>
</html>
设置文件:
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, '/')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)