def get_form_class(self): """ Returns the form class to use in this view. """ formtype = self.kwargs.get('formtype', None) try: return get_form(formtype) except: raise Http404
def render_inline_form(context, formtype): """Render inline form.""" formtype = formtype.encode('utf8') try: formclass = get_form(formtype) form = formclass(referer, topic) action = reverse("dasform", kwargs={'formtype':formtype}) except: logger.warning('Form class could not be found: %s' % formtype) form = ContactForm() action = reverse("dasform", kwargs={'formtype':'ContactForm'}) senturl = reverse("sent") return { 'action': action, 'form': form, 'formtype': formtype, 'senturl': senturl, }