我正在使用Django-intl-tel-input
在用户注册页面中制作一个小部件来选择电话号码格式/国家,但该小部件没有出现在页面中并且终端给出以下错误:
Not Found: /accounts/signup/”https:
//code.jquery.com/ui/1.12.1/jquery-ui.js”
Not Found: /accounts/signup/”https://code.jquery.com/jquery-1.12.4.js”
Not Found: /accounts/signup/<link href=
[29/Jul/2019 14:10:52] "GET /accounts/signup/%E2%80%9Dhttps://code.jquery.com/jquery-1.12.4.js%E2%80%9D HTTP/1.1" 404 5475
Not Found: /accounts/signup/<script type=
[29/Jul/2019 14:10:52] "GET /accounts/signup/%E2%80%9Dhttps://code.jquery.com/ui/1.12.1/jquery-ui.js%E2%80%9D HTTP/1.1" 404 5493
[29/Jul/2019 14:10:52] "GET /accounts/signup/%3Clink%20href= HTTP/1.1" 404 5370
[29/Jul/2019 14:10:52] "GET /accounts/signup/%3Cscript%20type= HTTP/1.1" 404 5376
Not Found: /accounts/signup/”https://code.jquery.com/jquery-1.12.4.js”
[29/Jul/2019 14:10:53] "GET /accounts/signup/%E2%80%9Dhttps://code.jquery.com/jquery-1.12.4.js%E2%80%9D HTTP/1.1" 404 5475
Not Found: /accounts/signup/”https://code.jquery.com/ui/1.12.1/jquery-ui.js”
[29/Jul/2019 14:10:53] "GET /accounts/signup/%E2%80%9Dhttps://code.jquery.com/ui/1.12.1/jquery
-ui.js%E2%80%9D HTTP/1.1" 404 5493
我没有在这个模板中加载/调用任何 CSS 或 js 文件
{%load staticfiles %}
{% block content %}
<head>>
<link href="{{ form.media.css }}" rel="stylesheet">
</head>
<style>
#content{
margin-top : 4%;
margin-left : 18%;
margin-right : 2%;
margin-bottom : 6%;
}
</style>
<div id="content">
<h2>Sign up</h2>
<form method="POST" action="{% url 'accounts:signup' %}">
{% csrf_token %}
{{ form.as_p }}
<button type="submit" class="btn btn-primary">Sign up</button>
<p></p>
</form>
</div>
<script src="{{ form.media.js }}"></script>
<script>
jQuery(document).ready(
{{ form.media.js }}
);
</script>
{% endblock %}
和我的表格:
class SignupForm(UserCreationForm):
Telephone_num = forms.CharField(label='Phone Number', widget= IntlTelInputWidget())
class Meta(UserCreationForm.Meta):
model = MyUser
fields = ('first_name', 'last_name', 'email', 'password1', 'password2', 'hospital', 'clinic', 'address')
我试过使用django-phonenumber-field
,但它的小部件没有国家标志,而且不太友好我也试过
widgets = {
'Telephone_no': widgets.PhoneNumberPrefixWidget
}
将电话号码字段添加到fields
属性后,但它也不起作用。