title: Django Redirects
body: <p>I'm trying to get people on my site to access an entirely separate part of the site based on what user group they belong too. Here is the logic I've written so far:</p>
  
  <pre><code>if request.user:
      if request.user.groups.filter(name='A').count() &gt;= 1:
          return HttpResponseRedirect('/pageA')
      elif request.user.groups.filter(name='B').count() &gt;= 1:
          return HttpResponseRedirect('/pageB')
  else:
      return HttpResponseRedirect('/login')
  </code></pre>
  
  <p>And then urls: </p>
  
  <pre><code>url(r'', 'main.views.getIndex'),
  url(r'', include('a.urls')),
  url(r'', include('b.urls')),
  </code></pre>
  
  <p>So basically, I have group A &amp; group B - user can access "A" page and "B" page accordingly if they belong to the respective user group. Otherwise, they have to login (placeholder denial page).</p>
  
  <p>The logic seems to make sense, but I keep getting "too many redirects" error. In fact, the page actually gets to the statement I want it too but then upon returning HttpResponseRedirect, it stops working.</p>
  
  <p>Your help is much appreciated.  </p>