Tag archive for "development"

Migrating Django projects with fixtures

When migrating a Django project it's often useful to work with the built-in dumpdata and loaddata management commands. However, this can easily lead to errors like django.db.utils.IntegrityError: Problem installing fixture Could not load foo.Bar(pk=ba): (1062, "Duplicate entry for key 'app_label'"). Such errors indictate that a similar object already exists in ... 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

Import WXR files from server or on plugin activation

I recently patched the WordPress reset plugin to make it possible to reactivate multiple plugins after the reset. Until sivel releases an update you can download the patched version from my server. As I frequently need to wipe WordPress installs during development I was looking for a way to auto-load ... more

How to minify WordPress theme stylesheets properly

If you build WordPress theme you'll eventually come to the point where you want to minify the stylesheets. But the WordPress theming system has a fundamental flaw: It expects theme headers like name, version information etc. to be in the style.css. This is bad because removing the headers from the ... more

WordPress Pastebin

This plugin is for you if you like sharing your code. Turn your blog into a pastebin and keep your own code on your own site. You can tag your pastes like you tag your normal posts, and visitors can leave comments if you allow it. I wrote this because ... more

Better Lorem Ipsum Generator for WordPress

When you create WordPress plugins and themes it is often a good thing to test them on blogs with much data. Since 3.0 I use custom post types and custom taxonomies a lot and couldn't find a plugin that autogenerates them. Hence I wrote a new plugin. Features: Automatically create ... more

Merging and splitting XML files with simpleXML

Here's a way to merge parts of two XML files with PHP's simpleXML. This also preserves the attributes, which was where the information was stored in my case. This script will not work out of the box for you, so edit it. Use var_dump(), print_r() and friends. <?php $file1 = ... more

wp_enqueue_style, versioning and conditional CSS comments

I like to enqueue my CSS styles because it has the benefit of adding a version string. A link like style.css?ver=0.7 is useful because it will force visitors to download an updated style.css when the version number is increased. Here's what I currently use in my functions.php: <?php if ( ... more

WordPress is stupid

I have stopped using WordPress for personal projects and only use it professionally any more. In case you haven't been aware of this, WordPress core developers think that potentially breaking thousands of links on thousands of sites is an accepatable edge case. Here's a great summary of what has been ... more

How to add support for navigation menus to your WordPress theme

The new navigation menus system in WordPress 3.0 looks promising, but in my opinion it's not very usable yet. Anyway, here's one way to add navigation menus to your theme while maintaining backward compatibility: In your theme's functions.php add something like the following code: <?php function mytheme_addmenus() { register_nav_menus( array( ... more