Реализовываю стандартные комментарии django. Использую postgresql. На сервере при попытке добавить комментарий появляется следующее:
DataError at /comments/post/
invalid input syntax for type inet: "b''"
LINE 1: ... '2016-05-20T21:51:21.447504+00:00'::timestamptz, 'b'''''::i...
Форма с комментариями
<form action="{% comment_form_target %}" method="post">
{% csrf_token %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% for field in form.visible_fields %}
<div class="form-field">
{% if field.errors.count > 0 %}
<div class="error-list">
{{field.errors}}
</div>
{% endif %}
{% if field.name == "honeypot" %}
<div id="honeyput">{{ field }}</div>
{% else %}
<div class="label"> {{ field.label }} </div>
<div class="control">{{ field }}</div>
{% endif %}
</div>
{% endfor %}
<br>
<div class="submit-button"><input type="submit" class="btn btn-default" name="submit" value="Отправить"> </div>
</form>
{% endblock %}
settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'det_sad',
'USER': 'pavel',
'PASSWORD':'pavel',
'HOST': 'localhost',
'PORT': '',
}
}
nginx
server {
listen 80;
server_name detsky-sadik.ru;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/pavel/myproject;
}
location /media/ {
root /home/pavel/myproject;
}
location / {
include proxy_params;
proxy_pass http://unix:/home/pavel/myproject/myproject.sock;
}
}
Сгенерированная форма
<form action="/comments/post/" method="post">
<input type='hidden' name='csrfmiddlewaretoken' value='fJ59okEuDEYxKFPUORChHIcitXFcf1Qa' />
<input id="id_content_type" name="content_type" type="hidden" value="article.article" />
<input id="id_object_pk" name="object_pk" type="hidden" value="1" />
<input id="id_timestamp" name="timestamp" type="hidden" value="1463806250" />
<input id="id_security_hash" maxlength="40" name="security_hash" type="hidden" value="cf5846c5f8eb920a5fe4569c61d84c426226b0c8" />
<div class="form-field">
<div class="label"> Имя </div>
<div class="control"><input id="id_name" maxlength="50" name="name" type="text" /></div>
</div>
<div class="form-field">
<div class="label"> Адрес электронной почты </div>
<div class="control"><input id="id_email" name="email" type="email" /></div>
</div>
<div class="form-field">
<div class="label"> URL </div>
<div class="control"><input id="id_url" name="url" type="url" /></div>
</div>
<div class="form-field">
<div class="label"> Комментарий </div>
<div class="control"><textarea cols="40" id="id_comment" maxlength="3000" name="comment" rows="10">
</textarea></div>
</div>
<div class="form-field">
<div id="honeyput"><input id="id_honeypot" name="honeypot" type="text" /></div>
</div>
<div class="submit-button"><input type="submit"class="btn btn-default" name="submit" value="Отправить"> </div>
</form>