Things Learned During The Redesignby Justin Michalicek on Sept. 16, 2011, 8 a.m. UTC
While I've been working on changing the site around I've gotten to learn a few more things about Django. The biggest change is behind the scenes in the form of a taxonomy app. The first page to use this is the projects page and it can easily be used for any other similar pages, tagging, or any other categorization I might need.
I got to work with Django's contenttypes framework, which provides some really useful features. With the contenttypes framework you can create generic relations, which behave like a foreign key (sort of... it's more difficult to work with), but any model can be referenced.
I also used the mock library in my unit tests for testing custom template tags. I barely scratched the surface of what can be done with mock. I only used it for pretending to be a specific class and then specified what the return value from a function call would be which required values that would not be easy (or maybe possible) to get set from the test environment. Mock has lot more functionality where you can record what methods were called and attributes were accessed, automatically generate new mock objects from your current mock object, and ensure that your mock object will only respond to attributes and method calls that exist on the real object.
I got the idea to use mock for testing template tags from http://techblog.ironfroggy.com/2008/10/how-to-test-django-template-tags-part-1.html where a more complicated version of what I did is shown.
I've got a few changes to make on the taxonomy app and then it will probably get split out from the main CMS code for release. After that is complete I would like to start using EpyDoc and put together a proper release script using Fabric