This post is simply stating the obvious. Sometimes even obvious things, in the wee hours of the morning, aren't so.
When you specify parameters in your URLconf like:
urlpatterns = patterns('',
url(r'^mark/(?P<id>\d+)/(?P<complete>\d+)/$', views.mark, name='mark'),
)
Keep in mind that each captured argument is a Python string. Even if the regex only captures integers - 'complete' is still passed as a Python string to your 'mark' view.
So if you intended to pass a 0 for false and 1 for true you must make sure to convert to an integer because only a string of length 0 is False. ('0' == True)
def mark(request, id, complete):
todo = get_object_or_404(pk=id)
todo.complete = int(complete)
todo.save()
return HttpResponse()
Related posts:
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.