from django import forms, template from django.forms.formsets import all_valid from django.forms.models import modelform_factory, inlineformset_factory from django.forms.models import BaseInlineFormset from django.contrib.contenttypes.models import ContentType from django.contrib.admin import widgets from django.contrib.admin.util import quote, unquote, get_deleted_objects from django.core.exceptions import ImproperlyConfigured, PermissionDenied from django.db import models, transaction from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404, render_to_response from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils.text import capfirst, get_text_list from django.utils.translation import ugettext as _ from django.utils.encoding import force_unicode try: set except NameError: from sets import Set as set # Python 2.3 fallback HORIZONTAL, VERTICAL = 1, 2 # returns the