I find that class-based views help keep my code readable and streamlined.
Take, for example, the sample (function-based) view from the form documentation:
def contact(request):
if request.method == 'POST': # If the form has been submitted...
form = ContactForm(request.POST) # A form bound to the POST data
if form.is_valid(): # All validation rules pass
# Process the data in form.cleaned_data
# ...
return HttpResponseRedirect('/thanks/') # Redirect after POST
else:
form = ContactForm() # An unbound form
return render_to_response('contact.html', {
'form': form,
})
In the class-based equivalent, the boilerplate code and the nasty nested ifs disappear:
class Contact(FormView):
template_name = 'contact.html'
form_class = ContactForm
success_url = '/thanks/'
def form_valid(self, form):
# Process the data in form.cleaned_data
return super(Contact, self).form_valid(form)
Also, while you can always mix and match function-based and class-based views, I find that mixing styles in the same Django app tends to look quite messy. So, once I have a few views that really benefit from going class-based, it is an easy step to switch all the lot.