Blog categories
- Web development (13)
- Python (9)
- Django (8)
- Javascript (4)
- HTML (3)
- jQuery (3)
- MongoDB (3)
- PHP (2)
- MySQL (2)
- Linux (1)
- GridFS (1)
- GD (1)
- VLC (1)
- Mac OS (1)
- IPTV (1)
- Ubuntu (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 ...
-
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 ...
-
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 ...
-
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 ...