Database browsing with Django

After few days of building a database browsing tool with Django, I must say: Django is brilliant!

Example patient information
I have set up browsing for all the major database entities: hospitals, surgeons, patients, operations and factors (a factor is a disease, procedure, etc). The database browsing website is intensively interlinked. Every hospital, surgeon, factor, etc is linked, so you can click it and follow to information about it.

Almost everything was done using the generic views, which means that I didn’t have to write the views myself. I decided to migrate the data instead of using the legacy tables directly. It required a bit of work with migrating the data, but I wanted to have pure Django-generated tables. Besides reading the Django documentation, what I have done was:

  • Write models for my data: Hospital, Surgeon, Patient, Operation, Factor
  • Move the data from the old tables to Django tables
  • Generate slugs for nice URLs (slug-is-this-king-of-string)
  • Design URLs (/hospitals/, /hospital/CODE/, etc)
  • Write templates (hospital_list.html, hospital_detail.html, etc)

The next major task will be creating the “related factors” view. It seems like I’ll have to write a custom SQL query for that. The question is: having a given factor (tag), what else factors are associated with patients with my given factor?


Author: automatthias

You won't believe what a skeptic I am.

3 thoughts on “Database browsing with Django”

  1. Hi Maciej,
    I am working on a similar project to this one. I am running into some problems. =(. I was wondering if you could release the code, or direct me to the code that you have implemented for this database? It would be very helpful for me.
    Thanks a lot,

  2. Hi Eugene,

    The code I wrote back then is tightly related to the particular database I’ve been working on, and not usable with any other one. If you’re looking to get started with a framework such as Django, I recommend following an introductory tutorial. The rest will flow out of your particular needs; you’ll probably write a couple of models to match the database (but beware of multi-column composite primary keys), and templates to display your data. If you want to look at a Django code example, you can look at the django-phpbb project I wrote some time ago.


Comments are closed.