Tag archive for "django"

RuntimeError: App registry isn't ready yet

The upcoming Django 1.7 has many interesting and welcomed changes. One of them is an update to how applications are loaded. The relase notes also mention potential problems with these changes. I ran into RuntimeError: App registry isn't ready yet while using the self-contained tests approach, but the fix is ... more

Django-filter and custom querysets

Django-filter is a powerful tool, but the documentation is a little sparse. If you want to see examples of custom Filters you have to dive into the source code. I recently wanted to add a filter for methods on a custom QuerySet. Unlike custom managers, custom QuerySets allow you to ... more

Using django-tables2, django-filter and django-crispy-forms together

Using django-tables2, django-filter and django-crispy-forms together I was recently working on a very CRUDy prototype and decided to use some Django applications and tools together I hadn't combined yet: Django-tables2, an excellent application that allows you to quickly build tables Django-filter for easy filtering Django-crispy-forms for easy form creation A view that uses all three apps ... more

Video and image sitemaps in Django

I recently added a sitemap to a site with many images and videos. Having the media files in the sitemap helps search engines to index them. I hadn't done this with Django before, so here are some notes. If you're not familiar with sitemaps in Django check out the official ... more

Django Webmaster Verification

Today I have released version 0.2.1 of django-webmaster-verification. I never took the time to write a post about it, so here you go. The Django application helps to quickly register with various webmaster tools like: Google Webmaster Tools Bing Webmaster Tools Yandex Webmaster Tools Majestic SEO Alexa These tools can ... more

Another scoop of Django testing

Two scoops of Django is a good book, and I recommend it to anyone who's working with Django. So when I finally got around to using travis-ci I turned to the packaging and testing chapters, but couldn't find anything that would really help me. Travis is a continuous integration service ... more

Values instance has no attribute 'default_reference_context'

I was just editing some reStructuredText content for my website when Django threw a strange error at me. Values instance has no attribute 'default_reference_context' What was really bizarre is that exactly the same rst content could be published as HTML just fine in a test script: from docutils.core import publish_parts ... more

At last - fixed RSS feeds

It's been more than two years that this site has been running on Django, but I had never gotten around to making really good RSS feeds. Some entries didn't contain the relevant content, others didn't format it properly, etc. Fortunately I have learned enough about Django by now that it ... more

Django almost spaceless template tag

Django has a {{ spaceless }} tag that's a little too greedy for my taste. Removing all whitespace between HTML tags can actually change what the browser renders, so here's a less greedy variant. However, it removes all whitespace, not just between tags, so if you use the pre tag ... more

Additional context for class based views through urlconf

I thought there was a simpler method of adding context through the urlconf but after having a look at the source this is what I came up with. Apparently there's only get_context_data() so I used a lambda to add what I needed. Update: I should probably have used extra_context={'model': 'Frontpage'} more