LabHamster Purchase Management

by graik



Django project for simple purchase / order management, mostly targetted at scientific labs. However, the work flow is very simple and generic:

  1. User A registers a product.
  2. User A or B creates an order for this product (status="pending").
  3. User C initiates the purchase (status="ordered")
  4. Whoever collects the item, sets the order status to "received".

The advantage for users A and B is that they can quickly figure out what the state of their request is and that they, later, can quickly initiate follow-up orders for the same product. The advantage for the purchase manager C is that all the order requests are collected in one place, catalogue numbers are required and prices or links as well as comments can be provided by the user. There is a trail of who requested, who ordered and who received an item and when. Filtering and full-text search facilitate finding products or past orders. Products can be categorized and products and orders can be exported as CSV tables for further processing in Excel.

Technically, LabHamster is a small and very standard Django project using not much more than the out-of-the-box Django admin interface with a pretty standard data model.

Setup your own LabHamster instance on Heroku

Click the following button to quickly spin up your very own instance of the LabHamster web server:

Deploy to Heroku

Fill out the form and your web server will be up and running in a minute. The app name you choose will be part of the default address, which will look like this: You can later easily connect this server to your own domain. The free configuration offered by heroku should be fine for the kind of teams that LabHamster is intended for. However, it needs to be inactive for at least 6h per day and there are a couple of seconds delay when the server hasn't been used since more than 30 min. These restrictions are removed if you upgrade to the "hobby" scheme (7 USD / month).

Modify and update a running heroku app

  • You can use the heroku dashboard to update your app directly from the labhamster.git repo.

  • To make changes to your LabHamster server, clone the app project locally using the Heroku Toolbelt:

    heroku login
    heroku git:clone --app YOURAPPNAME
  • ... and then update the heroku app from your local computer:

    git remote add origin
    git pull origin master # may trigger a few merge conflicts, depending on how long since last update
    git push heroku master
  • This latter option has the advantage, that you can test changes locally. See section [Setup for development].

Getting started

  1. Log in to the server with the admin user name and using labhamster2016 as your password. Then change the password by clicking the link in the upper left corner. You will find the database populated with two more example users (test_user and test_manager) and some example data and product categories.
  2. Log in with the "normal" test_user account as well as with the test_manager account (same password as above) to test the different permissions given to each of them.
  3. Log in as admin and create a new user account. Assign the user to the labmember group in order to give her or him basic permission to add and edit products, orders and vendor info.
  4. Create a new user account and assign it to both labmember and labmanager group in order to give her or him the permission to create and change product categories, grants, and to also add new user accounts.
  5. Once you have familiarized yourself with how all this works, delete the original test_user and test_manager users.

Setup for development

Download, prepare virtual python environment and install dependencies (replace git by the heroku clone command from above if you want to start from a app deployed to heroku):

git clone labhamsterdjango
cd labhamsterdjango
virtualenv venv
source venv/bin/activate
pip install -r requirements_local.txt

Create empty database tables (by default a very inefficient SQLite database, modify to change that):

./ migrate

You can load a very small example data set into the database. This will also create a super user "admin" with password labhamster2016:

./ loaddata initial_data.json

If you did not load the example data, you should at least create a super user account. Otherwise you won't be able to log into your labhamster server.

./ createsuperuser

Start Django's built-in debugging server:

./ runserver

Point your web browser to and enjoy!


LabHamster is released open source under the MIT license.