Contributing to Django Framework is easier than you think
Anderson Resende • 15 February 2017
For those who are starting to code and wish to make open source, sometimes it is hard to start. The idea of contributing with that fancy and wonderful lib that you love can sound a little bit scary. Lucky for us many of those libs have room for whoever is willing to start. They also give us the support that we need. Pretty sweet, right?
Do you know that famous python framework? Django! There is one section on their website called Easy Pickings. It was made for you who is willing both to get started with Open Source and to contribute with an amazing lib!
In this blog post I will show you step-by-step how I got started contributing the to open source by fixing a Django easy pick issue and how you can do the same in few steps. I will use a bug fixed by me to explain everything from the beginning to the end. Bear with me!
Finding a fix/bug
The first thing that you need to do is to visit the Django section Easy pickings. There you can find tickets that are easy to fix and small bugs. Every day new tickets are posted there. Try to find a ticket that is not assigned to anybody. Look at the image below:
In my case I choose that bug ticket #26026 and assigned it to myself, let's take a deeper look into the issue. In the image below I am just showing the header of the ticket. Please read the complete ticket.
As I have told you before, I have already solved this bug. So I am assigned to it, the bug is closed and there are some related PRs. When you choose a bug don't forget to assign the bug to yourself. This will prevent other people from picking the bug to work with. You need to be logged on the Django site, there are links on the top of the ticket page for that.
If you opened the ticket you will probably have noticed some discussions where the people suggested some solutions and made comments about the problem. People in the community are normally very helpful.
Ok! We've found and understood an open ticket.
The first step is to fork the Django repo. Second, write your code and make a commit following the style suggested by Django's guidelines. Take a look at my commit name: [1.9.x] Fixed #26026 -- Checked if the QuerySet is empty. So you can finally make a pull request.
Let's take a look at my pull request and check the code I wrote. Note that I commented the PR with a link to the ticket it covers.
Simple, don't you think? That was my solution, just one line of code. But check bellow the answer I got:
Uhumm... The problem was that I made a pull request to the wrong version of Django. Also, I forgot to write tests to my fix. Let's fix that!
This is my second PR, now against master and with tests alongside my code that I had already written. Notice that the name of my commit has changed (Is the same name of my PR).
Done! My PR was merged and closed. I have contributed to the amazing Django!