Added a Topic Feature

Posted in Django on February 14th, 2010 by Stephen DeGrace Link

I just finished adding a Topic feature to my Blog application. The concept is similar to tagging, which for good or for ill I deliberately decided not to implement. The idea is that topics will allow me to more easily connect related articles, which since creating my "Doom Series" I have had the desire to do.

Originally the idea was that the ability to create an arbitrarily large number of blogs would create the desired separation of concerns. While I still stand by this use, topics fill an important vacuum because an article can have multiple topics, and because a topic can cut across multiple blogs. The "Doom Series" (I wanted to name the topic "Doom" originally, but I went with "Crystal Ball" for a more hopeful-sounding tone Smile) is a great case in point.

I went with an addition to the Blog application rather than a stand-alone tagging application because I feel that the type of things you would tag in for example a Gallery picture or a Blog article are fundamentally different. If I implement tags for photos I may share some code, but I am going to customize it for that application and encapsulate it within that application.

One note: the Topics interface makes heavy use of AJAX, being my second Django/AJAX project with jQuery. This time I upgraded to jQuery 1.4.1. I do not like the fact that jQuery changed the way JSON data is submitted using the AJAX methods in order to cater to PHP and Ruby on Rails, so that when you have a key pointing to an array, the characters "[]" get appended to the key. In Django, then, you have to either manually cut off the last two characters of certain keys, or else in your Javascript code you have to add a call to jQuery.ajaxSetup({traditional: true}) to get the old behaviour. In my opinion, it just creates a backwards compatibility problem for many frameworks while adding no value.

But overall I like the improvements in 1.4.

Comments:

There are 0 comments on this item. Be the first to comment.

Post a Comment

* :
* :
:
:

* Required field, your email will not be posted.