I asked the question on StackOverflow and got an answer within minutes :-)
Anyways here's how I did it. I had 3 files in my index:
The first 2 files were fine, but I did not want to commit the entire view file with the first two, I wanted only one change in that file to go in this commit.
Since I had already added the view file to the index, I first had to unstage it with:
git reset app/courses/view.py
Then I did an interactive add to add only one hunk from the view file:
git add --patch apps/courses/view.py
Running this command showed me the first hunk from the file and an option asking me if I wanted ti stage that hunk. I decided I did not want the first hunk, then it showed me the second hunk. This was the change I wanted, so I entered 'y' at the option and proceeded to enter 'n' for all the remaining hunks.
After this I wanted to ensure that the right hunk from the file was staged to be committed, so I typed:
git diff --color --cached apps/courses/view.py
This showed me all the changed that were staged. After ensuring that the changes I wanted were the ones staged, I commited them with: