Django Unit Testing with Vim

The last post we’ve shared included setting up & using Vim for Python/Django-related development. I’ll assume throughout the guide that you’ve been using Vim ever since (Vim is amazing :)). Well, let me add up another helpful tutorial on how to use vim, this time for your unit tests. We’ll …

Easy Django form customization using django-widget-tweaks

When customizing Django forms, you usually have to add it on the forms definition using the widget. Say for example you want to add a class attribute to a form input. You have to do it this way forms.py : from django import forms class VolunteerForm(forms.Form) name = forms.TextInput() address =forms.TextField(widget=forms.Textarea(attrs={‘class’:’volunteer_class’})) …

How to setup automatic deletion of files referenced by a filefield after record is deleted. Django 1.3

In Django 1.3 deleting a record of a filefield will not automatically delete the file associated with the record. This is done to prevent data loss scenarios such as roll back transactions and different models representing the same file. So to clean up unrepresented files in the database, you have to …

Django-tinymce options and plugins

In our previous post, we discussed Django-tinymce, a JavaScript WYSIWYG editor that converts an HTML textarea field into an editor instance.  Again, django-tinymce is a Django application that contains a widget that renders a form field as a TinyMCE editor. This is especially helpful when you have forms that require …