Commits

James Bennett  committed c7d7db4

Backwards-incompatible change: remove login_required argument to contact_form view. Use the actual decorator in the URLConf instead.

  • Participants
  • Parent commits 37fd492

Comments (0)

Files changed (2)

File contact_form/views.py

 from django.http import HttpResponseRedirect
 from django.shortcuts import render_to_response
 from django.template import RequestContext
-from django.contrib.auth.views import redirect_to_login
 
 from contact_form.forms import ContactForm
 
 
 def contact_form(request, form_class=ContactForm,
                  template_name='contact_form/contact_form.html',
-                 success_url='/contact/sent/', login_required=False,
-                 fail_silently=False):
+                 success_url='/contact/sent/', fail_silently=False):
     """
     Renders a contact form, validates its input and sends an email
     from it.
     pass the ``success_url`` keyword argument; if not supplied, this
     will default to ``/contact/sent/``.
     
-    To allow only registered users to use the form, pass a ``True``
-    value for the ``login_required`` keyword argument.
-    
     To suppress exceptions raised during sending of the email, pass a
     ``True`` value for the ``fail_silently`` keyword argument. This is
     **not** recommended.
             The form instance.
     
     """
-    if login_required and not request.user.is_authenticated():
-        return redirect_to_login(request.path)
-    
     if request.method == 'POST':
         form = form_class(data=request.POST, files=request.FILES, request=request)
         if form.is_valid():

File docs/views.txt

 pass the ``success_url`` keyword argument; if not supplied, this will
 default to ``/contact/sent/``.
 
-To allow only registered users to use the form, pass a ``True`` value
-for the ``login_required`` keyword argument.
-
 To suppress exceptions raised during sending of the email, pass a
 ``True`` value for the ``fail_silently`` keyword argument. This is
 **not** recommended.
 Context::
 
     form
-        The form instance.
+        The form instance.