Posts tagged 'Django' – Page 2

"Django Model Managers via Related"

It is fairly common practice to use a custom model manager when you have a certain field(s) that you know you will be filtering by a lot. I found a small caveat from the traditional approach when you take related objects into account. Take this classic example for published ...

"Django + Typography = django-typogrify"

Something I've put off dealing with (until today) is typography. As a little bit of history: the typewriter forced us to sacrifice certain printed media standards because of its monospaced font. Things like double-spacing between sentences and using straight quotes can be considered typewriter-era "hacks" so this portable machine ...

"Facebook Meta-tags using Django and Jade"

I've found the Facebook doesn't do the best job of inferring general information from my blog articles on its own. Fortunately, the folks at FB provide a name-spaced meta tag schema more commonly known as Open Graph.

Implementing a quick self-explanatory in a Django template using Jade is ...

"Cache Timeout Default in Django"

I had to break a bad habit where I always specify explicit cache timeout settings when building custom template tags. For example, I might have a news feed for the homepage that looks something like this:

    from django.conf import settings
    from django.core.cache import cache
    from django.template ...

"Django and Jade"

This week I made an important addition to my tool kit. In the past I've focused primarily on ways to streamline backend development using tools like django_compressor, Sentry, and Fabric. More recently, however, I've taken a turn and began focusing on ways to bring my frontend up to ...

"Why Build a Blog with Django?"

This question comes up a lot, both in flame wars and in rational discussion. Why would you take time to build a blog application with Django when there are engines like WordPress that do the same thing out of the box. Well it depends.

The number one reason I think ...

"ImportError: cannot import name indexes"

I'm certainly not the first person to hit this caveat with django-haystack, as this error has been reported for over a year now. However, I had trouble finding a concise and reputable workaround. Daniel Lindsley, the guy behind django-haystack, has alluded to a workaround in the haystack docs, but ...

"Exporting `auth` Fixtures"

I've discovered, rather painfully, that setting up auth fixtures for testing requires a little care. Problems result when South migrations interfere with fixture permissions.

The best way to dump auth data is to use natural keys and avoid the permission model altogether:

./manage.py dumpdata -n auth.user auth ...

"Django Media: Cleaning Up Your Mess"

Sometimes it's too easy to fire and forget when it comes to setting up FileFields in Django. Over time, a lot of media can become stale as objects are deleted--wasting storage space. Here is a quick way to keep your waste footprint down: Store assets for every object in ...

"Two Subdomains, One Django"

I want to serve two sub-domains from the same Django project--not unheard of, see the countless multi-lingual sites out there. My goal, however, is specifically to share the whole project, except for the URLs. In theory, I could make use of Django's"sites" framework. The first thing to do ...