Adding a field to the profile: Difference between revisions

From OpenHatch wiki
Content added Content deleted
No edit summary
No edit summary
Line 6: Line 6:


This tutorial walks you through adding that feature to the November 17, 2010 version of the OpenHatch code.
This tutorial walks you through adding that feature to the November 17, 2010 version of the OpenHatch code.

= Introduction and prerequisites ==


Together, we will change the OpenHatch source code, which builds on top of Django and Python. You'll see how to go all the way from a new feature idea to making and testing the change. On the way, you'll see how to search, study, and test your code.
Together, we will change the OpenHatch source code, which builds on top of Django and Python. You'll see how to go all the way from a new feature idea to making and testing the change. On the way, you'll see how to search, study, and test your code.

Revision as of 00:30, 18 November 2010

This is a page about improving or modifying OpenHatch.

We call that "Hacking OpenHatch," and there is a whole category of pages about that.


The set-up

Today, on November 17, 2010, my OpenHatch profile doesn't have a special field for my IRC nickname. When I go to edit my profile, there's no place to put it in!

This tutorial walks you through adding that feature to the November 17, 2010 version of the OpenHatch code.

Together, we will change the OpenHatch source code, which builds on top of Django and Python. You'll see how to go all the way from a new feature idea to making and testing the change. On the way, you'll see how to search, study, and test your code.

The goal of this exercise is to show you the thought process we use when changing the website, give you confidence to try similar things on your own, and expose you to some helpful techniques that you might not know about.

Skills you need

In order to do this tutorial, you need to be willing to use a terminal and willing to learn some programming. The instructions are written for GNU/Linux systems, but Mac OS users will probably find the instructions work okay. (Windows users, I'm not sure.)

Getting help

If you try this and you get stuck, come come chat with us on IRC. Explain what you're doing, and what's not working, and we'll try to get you un-stuck. The same goes for if you can do the exercises but don't understand what they mean.

Getting the source

All the sample code in this walkthrough refers to version f69d180 of the OpenHatch source. To make sure the code is in line with what you expect, follow the instructions on the getting started with the OpenHatch code page. But right after you do the "git clone", do these commands:

$ git checkout f69d180 # Switch to that revision
$ git branch tutorial # Create a branch called tutorial that points at that revision
$ git checkout tutorial # Switch into that branch.

Here's how you can check that it worked. Run these commands in your new oh-mainline directory, and check that they have the same output as I've recorded:

$ git log -1 # look at the most recent commit on the current branch
commit f69d1801bad777b8bd495d166433879c21500069
Author: Asheesh Laroia <asheesh@openhatch.org>
Date:   Wed Nov 17 17:26:44 2010 -0500

    profile/models.py: Remove unused field.
$ git branch # see what the current branch is named.
  master
* tutorial
$

So far, so good? Let's dive in. (If not, chat with us on IRC!)