A second set of eyes
This weeks example, I received an IRC message asking if I could help out with a CSS issue. I'm not a "CSS guy" I'm more a "CSS thief" but I was game. So, we looked over his Django template and a solution eventually presented itself. I mocked it up, uploaded a patch and he merged it in. Great! Now he states if he could only figure out one other little issue.
I couldn't help myself, I was in programming mode. I asked "what was wrong?" A ManyToMany object wasn't printing out on his page and had him stumped. It stumped me to, I barely know Django and after going through all the documentation everything looked correct. I threw in a "{{ forloop.counter }}" and nothing showed up. Found sites that were doing exactly what he was trying to do and they matched. Finally I saw he had one little element "related_name" in the foriegnkey attribute. I had read about it, and it wasn't necessary so I thought "why not try removing it and seeing what happens." His code worked. Code he and then I had poured over for hours that was technically correct and one little "un-necessary" element was the cause.
No comments:
Post a Comment