Crispy forms and its "coercing to unicode need string or buffer nonetype found"

40 views
Skip to first unread message

RompePC

unread,
Aug 11, 2016, 6:58:20 AM8/11/16
to Django users
I was working on an admin panel, and when I try to get to the add/update view of the model, it just throws this error. I've been checking Google for all the morning, but the solutions I've just found aren't the problem I've (no problem with unicode, I check if the related object is None, etc.).

The exception throwed is (line 28):


coercing to
Unicode: need string or buffer, NoneType found

18
19 {% if field|is_checkboxselectmultiple %}
20 {% include 'bootstrap3/layout/checkboxselectmultiple.html' %}
21 {% endif %}
22
23 {% if field|is_radioselect %}
24 {% include 'bootstrap3/layout/radioselect.html' %}
25 {% endif %}
26
27 {% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
28 {% if field|is_checkbox and form_show_labels %}
29 <label for="{{ field.id_for_label }}" class="{% if field.field.required %} requiredField{% endif %}">
30 {% crispy_field field %}
31 {{ field.label|safe }}
32 {% include 'bootstrap3/layout/help_text_and_errors.html' %}
33 </label>
34 {% else %}
35 <div class="controls {{ field_class }}">
36 {% crispy_field field %}
37 {% include 'bootstrap3/
layout/help_text_and_errors.html' %}
38 </div>


Constantine Covtushenko

unread,
Aug 11, 2016, 3:23:59 PM8/11/16
to django...@googlegroups.com
Hi Rompe,

From you have posted I can suggest check your model.
Can you post here code of it?

Regards,

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/65bdca52-beba-4e02-a39a-5694ccbfbd66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

RompePC

unread,
Aug 12, 2016, 2:24:59 AM8/12/16
to Django users, constantine...@gmail.com
Hi there,

I apprecciate the help, but the models' code is secret (I'm not allowed to show it anywhere).
It is like it sends a non-existent field to the form, and don't know why. And the model is the same as the previous version, its very weird. And didn't found anything about that error in a crispy-form.
I'm sorry for the problems.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

RompePC

unread,
Aug 12, 2016, 4:12:13 AM8/12/16
to Django users
Ok, I just did again a unicode(..) call to a method that before worked without it. Sincerely, I just have no idea why now I need to do it.

Solved.

Constantine Covtushenko

unread,
Aug 12, 2016, 3:36:56 PM8/12/16
to django...@googlegroups.com
Hi,

Sounds great.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages