Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
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,
    }