Issue #17 open

Null-values && get_or_create

zw0rk
created an issue

Fails with exception:

{{{

!python

File "/home/zw0rk/ThirdParty/django-markitup/markitup/fields.py", line 91, in pre_save rendered = render_func(value.raw) AttributeError: 'NoneType' object has no attribute 'raw'

}}}

if markupfield is null=True and there is no value provided. For example, when using get_or_create().

Comments (2)

  1. Carl Meyer repo owner
    • changed status to open

    Using null=True for a CharField is generally not a good idea, as you then have two "empty" values, NULL and "" - in almost all cases, this is just needless confusion, as there's no meaningful distinction between those two varieties of "empty". So as a workaround, I recommend just not using null=True; use blank=True instead and the default "empty" value will be the empty string.

    That said, MarkupField(null=True) should still work. Pull request welcome!

  2. zw0rk reporter

    This is wrong, because: NULL-value is absence of value and ''-value is still a presence of empty value. In Postgre this situation is most obvious.

  3. Log in to comment