Blog categories
- Web development (13)
- Python (9)
- Django (8)
- Javascript (4)
- jQuery (3)
- MongoDB (3)
- HTML (3)
- PHP (2)
- MySQL (2)
- GridFS (1)
- GD (1)
- VLC (1)
- Mac OS (1)
- IPTV (1)
- Ubuntu (1)
- Linux (1)
-
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 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 ...
-
Dynamically creating and destroying an instance of TinyMCE with jQuery
Created by dan on Tuesday 8th December, 2009 at 3:29 PM
OK, so this is a bit of a quick one, but I thought I best blog it so that I can refer back later on. I have a DIV containing one or more paragraphs, which I want to be able to edit inline with TinyMCE. Seen as I'm using jQuery, ...
-
Creating a form submission handler with jQuery to handle checked items for deletion
Created by dan on Friday 20th November, 2009 at 3:56 PM
Following a little research, I found there to be no set solution for my problem, so I decided to sort it out myself and post the final solution here. Simply put, I have a form with some checkboxes, which when ticked and posted, trigger deletion on the selected item. Using ...
-
Creating an inline password change for a User ModelForm
Created by dan on Sunday 1st November, 2009 at 3:26 PM
I've always wondered why when creating a ModelForm for a User, that by default, there's just a single password field. Furthermore, when saving the form with this field populated, the password is overwritten with the raw value, not the encrypted value. So, I set about to provide the users of ...
-
Database transactions in Django
Created by dan on Thursday 29th October, 2009 at 3:11 PM
I've come to the point where I really need to go down the route of using database transactions for a few operations carried out on my Django project. As always, a simple search for 'django database transactions' in Google returns a, somewhat relieving official Django page with the documentation for ...
-
Updating content in-place on an Amino set-top box using Ant Fresco
Created by dan on Thursday 15th October, 2009 at 2:28 PM
Let me kick-start my blog by going in head-first, and posting my first nugget of information... While developing a well-involved IPTV system, I came across many, many frustrating limitations of Ant Fresco's browsing capabilities, although I'm fully aware that I'm using a dated browser, but it does handle things quite ...