September 27, 2008

Django browser for Redmine database

by orzel
Categories: Admin, Django, Software
Tags: ,
Comments: 7 Comments

Do you know redmine ? This is, to my knowledge, the best project manager you could ever find out there. I like to describe it as ‘trac done well‘. It has only one, big, ugly, fat inconvenient for me : it is written on top of ruby on rails. I could tell you how slow it is (true), or how many security flaws are found everyday in the ruby/rails world. But the real reason I’m actually really concerned about ruby/rails is that I don’t know ruby. When I look at the code I don’t understand anything, and I can’t change something to ‘suit my needs’, as is so common in Free Software.

I wish it was written in Django.

Well, anyway, I spent some times today to create a small Django application in order to display stuff from the redmine database. For this, I’ve used the wonderful “inspectdb” feature of Django, which access a database and creates the (Django) models required to access it.

Then, I had to ‘adapt’ those models and to create an admin.py file so that I could browse (and even modify) the database from django.

Adapting meant:

  • removing all the “id” field, they are automatically created by Django and it seems rails use the very same name (“id”) so this is compatible.
  • Change the “obvious” references to other model from IntegerField to ForeignKey
  • Some models reference themselves, you need to use a ForeignKey to ‘self’ (including quotes) to do that.
  • add some __unicode__(self) for the most important/obvious models

The admin works was basically about:

  • Creates Admin objects for all models (thanks vim’s macro!)
  • add list_display / list_filter args for the most important ones

And the remaining problem is :

  • It seems Boolean from ruby/rails have the values ‘t’/’f’ while those from django have 1/0 (fixed since then)

Mandatory screenshot (corresponding to the public stuff from http://labs.freehackers.org):

Example of djangoredmineadmin in use

Link to the project homepage


7 Comments »

  1. numerodix says:

    Python and Ruby are probably the two closest related languages in popular use. Personally I prefer Python, but if you know that then you basically know how Ruby works, with a few tweaks. Even if it looks different.

  2. Finn says:

    Looks nice!

    Could this become the basis for “Greenmine” project – a Redmine look-alike implemented in Django?

  3. @finn: no, I dont’ think so. The database layout is only a very small part of the system, though probably the most important one design-wise.

    There are some projects popping up recently for a project manager in django, in the same way as redmine. But honestly, even being such a big fan of django as I am, it would take a lot to make me quit redmine. This is really well done.

  4. Mocha says:

    @Thomas: as you mentioned above, could you please point out the names of the redmine-like django projects? thanks a lot!

  5. @mocha : this changes all the time, you can google for it. The last one i’ve heard about is ‘piano-man’ (ugly name if I dare say): http://lazypython.blogspot.com/2009/07

  6. Mocha says:

    @Thomas: thanks a lot! it does help. but the system not that impressive as Redmine. Just wondering why there is no killer applications from Django as Ruby community does.

Leave a Reply

Your email address will not be published. Required fields are marked *