title: Authentication User Django Depending on the User
body: <p>I'm stuck on my django project, I used django default login system, everything works great here, I have 3 users, the first one gets an "Admin Panel" the second one gets a "Capture info panel" and the Third one can only sees the content printed by the other 2 users. </p>
  
  <p>Myy questions are:</p>
  
  <p>What do I need to give permissions to each user?
  How can I redirect each panel to their respective user?</p>
  
  <p>P.S. I already have the templates to each panel with their urls and views but I don't know how to show them.</p>
  
  <p>Thanks in advance for taking your time to answer this newbies question but I just started working with this framework a week ago.</p>
  
  <hr>
  
  <p>Update</p>
  
  <p>Now I get a 404 error, instead of getting the page where I supposed to redirect.</p>
  
  <p>This is my urls.py</p>
  
  <pre><code>from django.conf.urls import patterns, include, url
  from .views import PanelRedirectView,PanelCapturista
  
  urlpatterns = patterns('',
  
  url(r'^$' , 'django.contrib.auth.views.login', {'template_name':'inicio/index.html'},
      name='login'),
  
  url(r'cerrar/$' , 'django.contrib.auth.views.logout_then_login', name='logout'),
  
  url(r'^panel-capturista/$' , PanelCapturista.as_view() , name="panel-capturista"),
  </code></pre>
  
  <p>)</p>
  
  <p>My views .py</p>
  
  <pre><code>from django.core.urlresolvers import reverse_lazy
  from django.views.generic.base import RedirectView,TemplateView
  
  
  class PanelRedirectView(RedirectView):
  
      def get_redirect_url(self, *args, **kwargs):
          user = self.request.user
          if user.groups.filter(name='gerente').count():
              return reverse_lazy('panel-gerente')
          elif user.groups.filter(name='capturista').count():
              return reverse_lazy('panel-capturista')
      else:
          return reverse_lazy('cliente')
  
  class PanelCapturista(TemplateView):
      template_name = 'capturista/panel-capturista.html'
  </code></pre>