Using Django’s FormPreview with @login_required

As part of Django’s ‘batteries included’ philosophy, it comes with the FormPreview class to make it easy to automate this workflow: “Display an HTML form, force a preview, then do something with the submission.” Also provided is the @login_required decorator which makes it easy and obvious to mark functions as requiring a logged-in user. Both these features are awesome by themselves, but wouldn’t it be great to combine them and observe how much the awesomeness increases? Let’s give it a shot.

Bug patches for django-voting and django-tagging

As part of my top-secret Django project, I’ve enlisted the help of the django-voting and django-tagging packages to provide rating and tagging, respectively, to my models. These work wonders and serve their purpose to a T, however, I’ve come across a couple small bugs that I wanted to document here, in addition to the bug reports I’ve posted.

Read the rest of this entry »

Multiple File Uploads in Django

As part of yet-to-be-announced project, I’m working with Django. After only a couple days, I’ve been able to produce some pretty cool results. One of the requirements that I have is that a user be able to upload a bunch of files when editing a form. Using Django’s newforms package, I was able to quickly add the ability to upload 1 file, but I wanted the user to be able to upload as many as they wanted.

Read the rest of this entry »