I have a field in the database which is with nullable=true, but when I set a null value to it and then display it in twig this way {{ null_variable}} it displays the text “empty_value”. How can I display nothing instead of this text? The onlu thing I can think of is this way
{% if variable==NULL %}
<td></td>
but I don’t think it’s a good way of doing this.
That’s a weird behavior, Twig shouldn’t returns ’empty_value’.
Are you sure you are not using it within a form?
Anyway, here is someway to do:
you may also use the
defaultfilter: