Low bandwidth asset management in Django
When developing low bandwidth sites, we must pay particular attention to the size and number of assets we include on a page...
When developing low bandwidth sites, we must pay particular attention to the size and number of assets we include on a page...
Using some of the new apps available for Django CMS 3.x along with a little config, we can make the process of adding a blog article much easier.
We've been using Django Haystack to provide search in our Django projects for a while now, and we've had some hard won wisdom we thought we should share with the world.
After adding a postsave signal to a model, our test suite runtime increased 5-fold! I found two ways to fix this: one in factory_boy, one in pytest.
Django together with Haystack adds a powerful free-text search capability to your applications, and is widely used. This article explains how to write safe, reliable, repeatable tests for the search features, and avoid a common gotcha with indexing objects that shouldn't be indexed.
Did some refactoring on the Intranet Binder monkeypatch library to enable temporary patches using Python's context objects. This is particularly nice for use in unit tests, where you might need to mock or stub out a component's dependencies, but you don't want those changes to be visible after your test finishes, or you only want them active for part of the test.
There is a Django app for assigning model instances to a specific country, but if you need to assign more than one, it becomes more complicated and is easy to get wrong. This is how I dealt with exactly this issue.
We frequently have multiple copies of a site running - the production server, the staging server and the local development copy. You want to be sure you are editing the correct site, and haven't switched sites by mistake. This post shows some methods to make it obvious which copy you are looking at.
Django's database query builder doesn't detect if you query a relation using an object of the wrong type, but silently returns wrong results. A new monkey patch catches this programmer error and reports it.
For about a year I've been working on our Django Binder app. It was originally designed for use in intranet applications, but much of the code is useful in Django apps of all kinds.
I've just committed a bunch of improvements from my work on the iSchool project, which I'd like to highlight to anyone interested, partly as internal documentation.
Fixed a bug in Django Dynamic Fixtures where you have a model whose primary key is not called id. Merged same day, thanks Paulo Cheque.
Publish What You Fund website, which shows aid transparency of each country in an Index was launched on October 2nd 2012!