How to set empty value to DateField in django model?
<p>What am I doing wrong here? I need to set empty value to doing_field. </p>

<pre><code>def delete_todo_today(request):
    if request.is_ajax() and request.POST and request.user.is_authenticated:
        thingtodo = ThingToDo.objects.filter(author = request.user, thing = request.POST.get('item'))
        thingtodo.doing_date = None
        thingtodo.save()
        data = {'message': "%s 's doing_date deleted" % request.POST.get('item')}
        return HttpResponse(json.dumps(data), content_type='application/json')
    else:
        raise Http404
</code></pre>

<p>You are using <code>.filter()</code> to get the objects for <code>thingtodo</code>. This will return a QuerySet or simply said a list of objects. You can not set an attribute on multiple objects directly. </p>

<p>If you wat to retrieve one object only, use <code>get()</code> instead of <code>.filter()</code>. This will raise an exception when there it more or less than one object matching.</p>

<p>If you want to update multiple objects, use the <code>update()</code> method of the QuerySet:</p>

<pre><code>thingtodo.update(doing_date=None)
</code></pre>

<p>Also make use that you model allows <code>Null</code> for the attribute.</p>

python django