Tag archive for "Django"

Django

This website was built with Django.

Values instance has no attribute 'default_reference_context'

2013-02-17

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

2013-02-16

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 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

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 getcontextdata() so I used a lambda to add what I needed. Update: I should probably have used extra_context={'model': 'Frontpage'} more

So I had this project with a peculiar requirement: It had to do a redirect to an existing object when the CreateView failed because such an object already existed in the db. Not really hard to do but it took me a while to figure out.. so here's the code. more

I recently moved my projects to gunicorn and needed init scripts. Here's what I'm currently using. I have the gunicorns running behind nginx, so you might want to tweak the IP and PORT settings. It might also be nice to use start-stop-daemon. more

I have an abstract base class that is used by various other models. The problem is that I need the same method that runs a query on all instances of those models, and that the manager isn't accessible via model instances. This is the code I ended up using. more

DjangoPythonBitcoinTuxDebianHTML5 badgeSaltStackUpset confused bugMoneyHackerUpset confused bugX.OrggitFirefoxWindowMakerBashIs it worth the time?i3 window managerWagtailContainerIrssiNginxSilenceUse a maskWorldInternet securityPianoFontGnuPGThunderbirdJenkinshome-assistant-logo