Thanks for the reply. I was wondering about the if statement about 
request.type as well, but I took the code from Stackoverflow and a 
combination of the original source code. It calls a Class.as_view() and I 
wasn't sure if I need to overwrite that as well. I didn't really want to 
write all the view code logic again as it kinda defeats the purpose of 
having a 3rd party app that does that for me.

According to the official documentation I'm still unsure if I need to type 
anything in my views.py at all.
As far as I understand this, I just need to subclass ContactForm somehow:

class ContactForm(forms.Form):
    """
    The base contact form class from which all contact form classes
    should inherit.

    If you don't need any custom functionality, you can simply use
    this form to provide basic contact functionality; it will collect
    name, email address and message.

    The ``ContactForm`` view included in this application knows how to
    work with this form and can handle many types of subclasses as
    well (see below for a discussion of the important points), so in
    many cases it will be all that you need. If you'd like to use this
    form or a subclass of it from one of your own views, just do the
    following:

    1. When you instantiate the form, pass the current ``HttpRequest``
       object to the constructor as the keyword argument ``request``;
       this is used internally by the base implementation, and also
       made available so that subclasses can add functionality which
       relies on inspecting the request.

    2. To send the message, call the form's ``save`` method, which
       accepts the keyword argument ``fail_silently`` and defaults it
       to ``False``. This argument is passed directly to
       ``send_mail``, and allows you to suppress or raise exceptions
       as needed for debugging. The ``save`` method has no return
       value.

    Other than that, treat it like any other form; validity checks and
    validated data are handled normally, through the ``is_valid``
    method and the ``cleaned_data`` dictionary.

taken from here: 
https://bitbucket.org/ubernostrum/django-contact-form/src/4b7d2fa20c1d01568fb7c4c800155378e176923b/contact_form/forms.py?at=default

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5c5e5b0a-fcb8-4928-b696-1f6c48e6e951%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to