6

I love Django. I really do. It's been fun to work with, and wrestle with, and beat my head over repeatedly. I really have enjoyed it. But why in the name of all that is even remotely holy must the URL documentation be so spotty? I finally did get my URL behavior to work, but now that I've created a view function for deleting objects in one of the models, the URL for the editing function breaks. All you do is click "edit" and it brings up this nice little form where you can edit the database entry by querying its ID number and then you can save that ModelForm and everything is fine. So the url scheme is http://foo.com/bar/edit/3/
Should work. Used to work. I swear it used to work, I pulled up an older commit and it works like a charm. Deleting works with that same url scheme.
http://foo.com/bar/delete/3/
deletes the object with id=3 no problem. The two URL schemes in urls.py match perfectly (except one says delete obviously).
But now something has gone and gotten ROYALLY derailed because every time I run that function, that CLEARLY PRESENT 3 is being passed as None. I thought, oh, maybe I rearranged the arguments and am passing in the wrong ID. Nope. Okay, so what if I mixed up the regex on the url? Nope. Matches. WHERE ARE YOU GETTING NONE FROM? I mean, I realize that's the default, but I'M PASSING AN ARGUMENT in.
{% url 'namespace:edit' id=object.id %}
breaks horribly whereas
{% url 'namespace:delete' id= object.id %} deletes the object just fine. Why, Django? We've been wrestling with this for hours. Give me a sign. Tell me what you want from me. I'll give it to you. I will. I promise.

Comments
Add Comment