Dan Ward Follow me on Twitter View my LinkedIn profile Subscribe to my news feed   

A self-confessed geek and web developer

 

Blog entries for 2010

From time-to-time, I'll have a brainwave while trying to figure out something tech-oriented; well, either that or I just want to get something off my chest. Anyhow, if I get round to typing it up, it'll wind up here in the blog.

Blog categories

 

Archive

  • Using Django's FormWizard with one or more ModelForm's

    Created by dan on Thursday 18th March, 2010 at 11:11 AM

    I've been looking at Django's form wizard implementation over the past day or so and learned quite a few new things, but one of them caught me out, yet only required a simple fix. Django appears to focus more on creating a FormWizard to work with flat forms, however if ...

  • Automatically append username domain based on current host with RoundCube Webmail

    Created by dan on Saturday 13th March, 2010 at 3:52 PM

    For a year now, I've been using the server drop down with RoundCube Webmail to append the domain to the username, meaning instead of having to enter 'person@domain.net' username field, I can just enter 'person' and the password. Having to choose the server each time from below the password box ...

  • A custom MongoDb/GridFS file wrapper for the Django HttpResponse object

    Created by dan on Monday 22nd February, 2010 at 4:28 PM

    Until today, I had been using Django's FileWrapper class to iterate over an open GridFS and yeild chunks to an HttpResponse object, however I noticed that files over 8 KB were being reiterated in the output. As far as I could fathom, the reason why this had been occurring is ...

  • Setting a toggler's link text to 'show' or 'hide' depending on the result of a toggle in jQuery

    Created by dan on Friday 19th February, 2010 at 11:51 AM

    Not explained very well in the title, but one thing I've found is that there's little supportive documentation on how to alter the text of a link which triggers a slideToggle() or toggle() in jQuery. To make the toggle a little easier for the user to understand what's happening, they ...

  • Loading Django template tags and filters automatically (without the {% load %} tag)

    Created by dan on Thursday 18th February, 2010 at 5:12 PM

    I'm not entirely sure of how well this is documented on Django's part, however using the {% load %} tag on each page template where tags and filters used surely break the DRY principle? Anyway, there is an easier way to load tags and filters for all templates. There's just ...

  • Removing IPython/libedit for the time being...

    Created by dan on Monday 15th February, 2010 at 10:42 AM

    Just a quick one I thought I'd share. At some point a while back I decided to install IPython, at least I assume I done it knowingly! Anyhow, I noticed that when I jumped in to the Django shell, I'd get a message along the lines of "Leopard libedit detected.", ...

  • Removing an entry from MongoDB in Python/Django using '_id' and getlist

    Created by dan on Friday 15th January, 2010 at 6:38 PM

    I've got to the point where I have a table containing all entries from a set Mongo collection. They each have a checkbox beside them with the value of '_id' where I can select them for a magical journey in to the mass deletion/modification abilities of the associated Django view. ...

  • Outputting an '_id' value from MongoDB in a Django template

    Created by dan on Friday 15th January, 2010 at 5:48 PM

    If you've not already noticed, Django's template rendering engine forbids referencing variables, which are prefixed with an underscore. Because of this, we have to faff about with a filter or alike. The below filter should do the job for the _id field. I'm not going in to any more detail on ...

  • How to create a slug field with Django forms

    Created by dan on Friday 8th January, 2010 at 3:14 PM

    A slug field is a field, which only accepts alphanumberic characters and underscores. When creating models in Django, a models.SlugField class exists, which validates against this rule. Quite frustratingly, however Django doesn't have a forms.SlugField class at the moment. It's time for drastic action! If any of you have been ...