title: django creating generic class to validate User authentication
body: <p>I am trying to replace the generic View class with a custom class so that the user authentication happens automatically when i make a reference to this class.</p>
  
  <p>The Base Class</p>
  
  <pre><code>class CustomView(View):
  
      def __init__(self, request):
          if not request.user.is_authenticated:
              redirect('register.registerForm')
  </code></pre>
  
  <p>The sub class</p>
  
  <p>class DashboardPage(CustomView):</p>
  
  <pre><code>def get(self, request):
      user_object = User.objects.get(username=request.user)
      all_files = user_object.files_set.all()
      return render(request, 'dashboard/dashboard.html', {'all_files': all_files})
  </code></pre>
  
  <p>I expected the user authentication happened automatically when the CustomView class is called. And also wanted to know if this is the best way to generalize user authentication for all the pages in my application which require authentication. </p>
  
  <p>I am getting the below error:</p>
  
  <pre><code>TypeError at /dashboard/
  __init__() missing 1 required positional argument: 'request'
  Request Method: GET
  Request URL:    http://127.0.0.1:8000/dashboard/
  Django Version: 1.11.7
  Exception Type: TypeError
  Exception Value:    
  __init__() missing 1 required positional argument: 'request'
  Exception Location: C:\Program Files (x86)\Python36-32\lib\site-packages\django-1.11.7-py3.6.egg\django\views\generic\base.py in view, line 62
  Python Executable:  C:\Program Files (x86)\Python36-32\python.exe
  Python Version: 3.6.3
  Python Path:    
  ['C:\\Users\\Varun\\Desktop\\newsite',
   'C:\\Program Files (x86)\\Python36-32\\python36.zip',
   'C:\\Program Files (x86)\\Python36-32\\DLLs',
   'C:\\Program Files (x86)\\Python36-32\\lib',
   'C:\\Program Files (x86)\\Python36-32',
   'C:\\Program Files (x86)\\Python36-32\\lib\\site-packages',
   'C:\\Program Files '
   '(x86)\\Python36-32\\lib\\site-packages\\django-1.11.7-py3.6.egg',
   'C:\\Program Files '
   '(x86)\\Python36-32\\lib\\site-packages\\pytz-2017.3-py3.6.egg']
  Server time:    Mon, 4 Dec 2017 20:43:12 +0000
  </code></pre>